CREATETABLE T1 ( id INTEGERNOTNULL GENERATED ALWAYS ASIDENTITY (START WITH1 INCREMENT BY1 MINVALUE 1 NO MAXVALUE NO CYCLE NO CACHE ORDER), ... );
Oracle(需要创建一个SEQUENCE和一个TRIGGER):
CREATETABLE T1 ( id NUMBER(10,0) NOTNULL, ... ); CREATE SEQUENCE T1_ID_SEQ INCREMENT BY1 START WITH1 NOMAXVALUE NOCYCLE CACHE 100ORDER; CREATEORREPLACETRIGGER INSERT_T1_ID BEFORE INSERTON T1 REFERENCING NEW AS new OLD AS old FOR EACH ROW BEGIN SELECT T1_ID_SEQ.NEXTVAL INTO :new.id FROM DUAL; END; /
MySQL
CREATETABLE T1 ( id INTNOTNULL AUTO_INCREMENT, ... );
<br />DB2<br />CREATE TABLE T1<br />(<br /> id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1 MINVALUE 1 NO MAXVALUE NO CYCLE NO CACHE ORDER),<br /> ...<br />);<br /><br />Oracle(需要创建一个SEQUENCE和一个TRIGGER):CREATE TABLE T1<br