--DROP TABLE Departments
--DROP TABLE Employees

CREATE TABLE Employees
(
ID int PRIMARY KEY,
Name VARCHAR(20)
)


INSERT INTO Employees VALUES (101, '%Default%')
INSERT INTO Employees VALUES (102, 'Joe')
INSERT INTO Employees VALUES (103, 'Jane')
INSERT INTO Employees VALUES (104, 'Joan')

SELECT * FROM Employees

--DROP TABLE Departments

CREATE TABLE Departments
(
ID int PRIMARY KEY,
Manager int DEFAULT 1001 CONSTRAINT FK_emp FOREIGN KEY REFERENCES Employees(ID)
ON DELETE  SET DEFAULT ON UPDATE SET DEFAULT,
BackupManager int DEFAULT 101 CONSTRAINT FK_bkp FOREIGN KEY REFERENCES Employees(ID)
---ON DELETE SET DEFAULT
)


INSERT INTO Departments VALUES (1999, 102, 103)
SELECT * FROM Departments

DELETE Employees where ID = 102
UPDATE Employees SET ID=1000 where ID = 102
