Sunday, August 30, 2009

MCTS 70-433 Parent/Child (e.g. Manager/Staff) relationship within a single table

Here you can use the "foreign key" within the same table...


create table employee (

empID int IDENTITY(1,1) PRIMARY KEY,

managerID int FOREIGN KEY REFERENCES employee (empID), 

...)


NB we could have written REFERENCES and omitted the keywords FOREIGN KEY.

No comments: