创建表语句
-- Create table
create table CAPITAL_ADJUST
(
CAPITAL_ID VARCHAR2(10),
CAPITAL_NAME VARCHAR2(50),
TYPE VARCHAR2(10),
BELONG VARCHAR2(50),
IN_DEP VARCHAR2(50),
ID VARCHAR2(10) not null,
IN_DEP_LEADER VARCHAR2(50),
OUT_DEP_LEAD VARCHAR2(50)
)
-- Add comments to the columns
comment on column CAPITAL_ADJUST.CAPITAL_ID
is '资产编号';
comment on column CAPITAL_ADJUST.CAPITAL_NAME
is '资产名称 ';
comment on column CAPITAL_ADJUST.TYPE
is '规格型号';
comment on column CAPITAL_ADJUST.BELONG
is '所属部门';
comment on column CAPITAL_ADJUST.IN_DEP
is '调入部门 ';
comment on column CAPITAL_ADJUST.ID
is '编号';
comment on column CAPITAL_ADJUST.IN_DEP_LEADER
is '拨出部门负责人 ';
comment on column CAPITAL_ADJUST.OUT_DEP_LEAD
is '调入部门负责人';
-- Create/Recreate primary, unique and foreign key constraints
alter table CAPITAL_ADJUST
add constraint PK_CAPITAL primary key (ID);
插入数据sql
INSERT INTO CAPITAL_ADJUST
(ID,
CAPITAL_ID,
CAPITAL_NAME,
TYPE,
BELONG,
IN_DEP,
IN_DEP_LEADER,
OUT_DEP_LEAD)
VALUES
(1, '001', '电脑', 'V001', '部门1', '部门2', '调入负责人', '调出负责人');
删除数据sql
DELETE FROM CAPITAL_ADJUST T WHERE T.ID = 1;
修改表
ALTER TABLE CAPITAL_ADJUST DROP COLUMN OUT_DEP_LEAD;
查询记录
SELECT * FROM CAPITAL_ADJUST;