-- CREATE TABLE USERS (
-- USER_ID NUMBER ( 11 ) PRIMARY KEY,
-- USER_NAME VARCHAR2 ( 100 ),
-- USER_PASSWORD VARCHAR2 ( 100 ),
-- EMAIL VARCHAR2 ( 100 ),
-- SEX NUMBER ( 4 ),
-- REGEDIT_TIME DATE,
-- LOGIN_TIME DATE,
-- BIRTHDAY DATE
-- );
-- CREATE TABLE KIND(
-- KIND_ID NUMBER(11) PRIMARY KEY,
-- KIND_NAME VARCHAR2(100),
-- KIND_DESC VARCHAR2(255)
-- );
-- CREATE TABLE TITLELIST (
-- TITLE_ID NUMBER ( 11 ) PRIMARY KEY,
-- KIND_ID NUMBER ( 11 ) ,
-- USER_ID NUMBER ( 11 ) ,
-- TITLE VARCHAR2 ( 255 ),
-- TITLE_CONTENT CLOB,
-- TITLE_UPTIME DATE,
-- PAGEVIEW NUMBER ( 11 ),
-- IS_TOP NUMBER ( 4 ),
-- IS_MAINPOST NUMBER ( 4 ),
-- CONSTRAINT FK_KIND_ID FOREIGN KEY( KIND_ID ) REFERENCES KIND( KIND_ID ),
-- CONSTRAINT FK_USER_ID FOREIGN KEY( USER_ID ) REFERENCES USERS( USER_ID )
-- );
-- CREATE TABLE REPLYLIST(
-- REPLY_ID NUMBER(11) PRIMARY KEY,
-- TITLE_ID NUMBER(11),
-- USER_ID NUMBER(11),
-- REPLOY_CONTENT VARCHAR(255),
-- REPLOY_TIME DATE,
-- PAGEVIEW NUMBER(11),
-- CONSTRAINT FK_TITLE_ID FOREIGN KEY(TITLE_ID) REFERENCES TITLELIST(TITLE_ID),
-- CONSTRAINT FK_REPLY_USER_ID FOREIGN KEY(USER_ID) REFERENCES USERS(USER_ID)
-- );
-- create sequence SEQ_USER_ID
-- minvalue 1 --最小值
-- nomaxvalue --不设置最大值
-- start with 1 --从1开始计数
-- increment by 1 --每次加1个
-- nocycle --一直累加,不循环
-- nocache; --不建缓冲区
-- CREATE OR REPLACE TRIGGER tg_USERID
-- BEFORE INSERT ON USERS FOR EACH ROW WHEN (new.USER_ID is null)
-- begin
-- select SEQ_USER_ID.nextval into:new.USER_ID from dual;
-- end;
INSERT INTO USERS(USER_NAME) VALUES('张三');
标签:11,自增,--,NUMBER,外键,ID,USER,KIND,主键 From: https://blog.51cto.com/u_12528551/5900108