自增序列
-- Create sequence create sequence SDICT_ID minvalue 1 maxvalue 99999999 start with 193 increment by 1 cache 16 order;
oracle索引
-- Create table create table DICT ( id NUMBER(8) not null, type VARCHAR2(32), name VARCHAR2(64), value VARCHAR2(32) ) tablespace GBITS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); -- Create/Recreate primary, unique and foreign key constraints alter table DICT add constraint PK_DICT_ID primary key (ID) using index tablespace GBITS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );
mysql:
- DROP TABLE IF EXISTS `workers_info`;
- CREATE TABLE `workers_info` (
- `id` int(11) primary key NOT NULL AUTO_INCREMENT,
- `workername` varchar(20) NOT NULL,
- `sex` enum(F,M,S),
- `salary` int(11) DEFAULT '0',
- `email` varchar(30),
- `EmployedDates` date,
- `department` varchar(30),
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- mysql> alter table workers_info ADD sex enum('F','M','S');
ALTER TABLE table_name ADD INDEX index_name (column_list)
ALTER TABLE table_name ADD UNIQUE (column_list)
ALTER TABLE table_name ADD PRIMARY KEY (column_list)
sqlserver:
drop table stuMarks create table stuMarks ( ExamNo int identity(1,1) primary key, stuNo char(6) not null, writtenExam int not null, LabExam int not null ) go -- 其中,列属性"identity(起始值,递增量)" 表示"ExamNo"列为自动编号, 也称为标识列
ALTER TABLE cust_id ADD cust_id_seq number(9) identity(1,1)