Referential Relationships Within a Table

You can establish a referential relationship between two columns of the same table. In the following example, the emp_num column in the employee table uniquely identifies every employee through an employee number. The mgr_num column in that table contains the employee number of the manager who manages that employee. In this case, mgr_num references emp_num. Duplicate values appear in the mgr_num column because managers manage more than one employee.
CREATE TABLE employee 
   (
   emp_num INTEGER PRIMARY KEY,
   mgr_num INTEGER REFERENCES employee (emp_num)
   );

A table in which referential relationships exist among its rows can have a PRIMARY KEY constraint with no explicit foreign key. For the syntax to recursively query a table in which multiple levels of a logical hierarchy exist among the rows, see Hierarchical Clause.