CREATE TABLE ACCOUNT(
ID INT(4) CONSTRAINT ACCOUNT_ID_PK PRIMARY KEY,
RECOMMENDER_ID INT(4) CONSTRAINT ACCOUNT_RECOMMENDER_ID_FK REFERENCES ACCOUNT(ID),
LOGIN_NAME VARCHAR(30) NOT NULL CONSTRAINT ACCOUNT_LOGIN_NAME_UK UNIQUE,
LOGIN_PASSWD VARCHAR(30) NOT NULL,
STATUS CHAR(1) CONSTRAINT ACCOUNT_STATUS_CK CHECK (STATUS IN (0,1,2)),
CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PAUSE_DATE DATE,
CLOSE_DATE DATE,
REAL_NAME VARCHAR(20) NOT NULL,
IDCARD_NO CHAR(18) CONSTRAINT ACCOUNT_INCARD_NO UNIQUE NOT NULL,
BIRTHDATE DATE,
GENDER CHAR(1) CONSTRAINT ACCOUNT_GENDER_CK CHECK (GENDER IN (0,1)),
OCCUPATION VARCHAR(50),
TELEPHONE VARCHAR(15) NOT NULL,
EMAIL VARCHAR(50),
MAILADDRESS VARCHAR(50),
ZIPCODE CHAR(6),
QQ VARCHAR(15),
LAST_LOGIN_TIME DATE,
LAST_LOGIN_IP VARCHAR(15)
);
字段寫上面,像這些主鍵,外鍵。。待該表的字段寫完之後寫到最下面,不要寫到字段後面