CREATE TABLE Employee
(
id INT,
boss INT REFERENCES Employee(id),
PRIMARY KEY (id)
);
One employee can have many bosses and one boss can have many employees.
Does this table function the same as this two-table design?
CREATE TABLE Employee
(
id INT,
PRIMARY KEY (id)
);
Create table ManagerRelation (
id_from int NOT NULL,
id_to int NOT NULL,
PRIMARY KEY (id_from, id_to),
FOREIGN KEY (id_from) REFERENCES Employee(id),
FOREIGN KEY (id_to) REFERENCES Employee(id)
);
The second table ManagerRelation stores ids of workers who have boss-employee relationship.
My question is, are these two design right? If right, are they exactly the same functionally?