Consider the following relational schema, DDL statements and tables. Show the st
ID: 3748970 • Letter: C
Question
Consider the following relational schema, DDL statements and tables. Show the status of the above tables after each of the following operations:
a. Inserting a new project: 7, Null into the Table PROJECT. If it is rejected, explain.
EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, Department ID)
PROJECT (ProjectID, EmployeeID)
DEPARTMENT( Department ID, DepartmentName)
CREATE TABLE EMPLOYEE
( EmployeeID INT PRIMARY KEY,
EmployeeName VARCHAR(50) NOT NULL,
SupervisorID INT DEFAULT 9,
DepartmentID INT,
FOREIGN KEY (SupervisorID) REFERENCES EMPLOYEE (EmployeeID)
ON DELETE SET NULL ON UPDATE SET DEFAULT
);
CREATE TABLE PROJECT (
ProjectID INT PRIMARY KEY,
EmployeeID INT DEFAULT 9,
FOREIGN KEY (EmployeeID) REFERENCES EMPLOYEE (EmployeeID)
ON DELETE SET NULL );
CREATE TABLE DEPARTMENT(
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(50)
);
Here is the table. https://imgur.com/a/G5UZxKC
Explanation / Answer
If you have any doubts, please give me comment...
INSERT INTO PROJECT VALUES(7, NULL);
Query Successfully executes.