create sequence seq_zs increment by 1 start with 1 maxvalue 9999999999999999999 minvalue 1 nocycle; //创建sequence
create table index_show (zsid number(21) NOT NULL,yhid varchar2(20) not null,zsmc varchar2(100),zsbt varchar2(100),zslb varchar2(5),tbms varchar2(30),qssl number(2),jbsj varchar2(10),syxsbz varchar2(2),syxssx number(5));// 创建新表
alter table index_show add constraint PK_zsid primary key(zsid);// 创建主键zsid
select * from sifs.index_show;// 查询表中全部数据
alter table sifs.index_show modify zsmc not null;//把zsmc一列设为非空
alter table sifs.index_show_detl add constraint fk_zsid foreign key(zsid) references sifs.index_show(zsid);//设置外键zsid,参照sifs.index_show的zsid列
alter table sifs.index_show_detl add constraint uni_zbbh unique(zbbh);//创建唯一性约束列zbbh
alter table sifs.index_show drop constraint uni_zsmc; //删除唯一性约束
alter table sifs.index_show rename column syxssx to xssx;//更改列名
alter table sifs.index_show_detl add constraint PK_zsidzbbh primary key(zsid,zbbh);//创建联合主键
delete from sifs.index_show; //删除表中全部数据
alter table sifs.index_show add txlx varchar2(2); //添加列
alter table sifs.index_show modify (zsbt varchar2(300));//修改字段长度
update sifs.index_show set yhid = 'admin',txlx = 'dg' where zsid = '174'; //更新一行数据