Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Table
 

A foreign key to reference itself

SQL> SQL> create table employees   2  ( empno      NUMBER(4)    constraint E_PK   3                            primary key   4                            constraint E_EMPNO_CHK   5                            check (empno > 7000)   6  , mgr        NUMBER(4)    constraint E_MGR_FK   7                            references employees) ; Table created. SQL> SQL> drop table employees; Table dropped.