One (mandatory) to Many [recursive]
Diagram 1m2M-rec.png
How to read One employee may manage many employees. Each employee is managed by exactly one manager.
Relevant relations The many side of this relation can be either optional or mandatory.

The table structure is as follows:

employee(__id__, name, mgr_id*, <e_other>)

The SQL create statement is as follows:

create table employee
  (id type primary key,
   name type,
   mgr_id type not null,
   <e_other>,
   foreign key (mgr_id) references employee);

Back to ER to SQL page.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License