ORACLE中的五种约束
CREATE TABLE TABLENAMEEXAMLE(
PRIMARYKEYFILED NUMBER(2)
CONSTRAINT PK_ID PRIMARY KEY,
NULLEXAMPLEFIELD VARCHAR2(8)
NOT NULL,
FOREIGNKEYFIELD NUMBER(2)
CONSTRAINT FK_ID FOREIGN KEY(FOREIGNKEYFIELD) REFERENCES ANOTHERTABLE(PRIMARYKEYFIELDNAME), FILEDUNIQUEEXAMPLEFIELD VARCHAR2(64)
UNIQUE,
CHECKEXAMPLEFIELD NUMBER(7,2)
CONSTRAINT CONSTRAINTNAME
CHECK(CHECKEXAMPLEFIELD>0 AND CHECKEXAMPLEFIELD<=3000)
}