Restrictions
Unique key (unique):
constraint Constraint_name UNIQUE (columu),
Constraint_name Constraint name columu Field name
Example: constraint emp_uk UNIQUE(empID);
The constraints of the query table, select constraint_name ,constraint_type from user_constraints
where table_name ='表名';
Primary key (paimary key):
constraint constraint_name PAIMARY KEY (columu),
Not Null Constraint Query
select constraint_name , constraint_type,search_condition from user_Constraints
where table_name = 'table name'; check (check):
Constraint constraint_name CHECK (condition)
Foreign Key:
constraint constraint_name Foreign Key (column) references table_name(cloumn);
references to
Add constraints:
Alter TABLE table ADD[ CONSTRAINT constraint] type (column)
例子:ADD constraint depart_empid_fk FOREIGN KEY(empid) REFERENCES EMP(empid);
Startup constraints:
ALTER TABLE depart ENABLE constraint depart_empid_fk;
Turn off constraints:
ALTER TABLE depart DISABLE constraint depart_empid_fk;
Remove constraints:
alter table depart drop constraint depart_empid_fk;