Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the SQL coe for the Dependent table shown in the picture. Te rest of the SQL code for the other tables will be provided
Create the SQL coe for the Dependent table shown in the picture. Te rest of the SQL code for the other tables will be provided below
SQL CODE:
CREATE TABLE EMPLOYEEmaw
SSNNumber CHAR NOT NULL,
FirstName VARCHAR NOT NULL,
MidName CHAR,
LastName VARCHAR NOT NULL,
Birthday DATE,
Address VARCHAR
Gender CHAR CHECK Gender IN MFmf
Salary DECIMAL DEFAULT
SupervisorSSN CHAR
DepartmentNumber INT,
CONSTRAINT EMPLOYEEPK PRIMARY KEYSSNNumber
CONSTRAINT EMPLOYEEFK FOREIGN KEYSupervisorSSN REFERENCES EMPLOYEEmawSSNNumber;
CREATE TABLE DEPARTMENTmaw
DepartmentName VARCHAR NOT NULL,
DepartmentNumber INT NOT NULL,
ManagerSSN CHAR NOT NULL,
ManageStartDate DATE,
PRIMARY KEY DepartmentNumber
CONSTRAINT DEPARTMENTFK FOREIGN KEY ManagerSSN REFERENCES EMPLOYEEmaw SSNNumber;
CREATE TABLE DEPTLOCATIONmaw
DepartmentNumber INT,
DepartmentLocation VARCHAR
CONSTRAINT PKDEPTLOCATION PRIMARY KEY DepartmentNumber
CONSTRAINT FKDEPTLOCATIONDEPARTMENT FOREIGN KEY DepartmentNumber REFERENCES DEPARTMENTmaw DepartmentNumber ON DELETE CASCADE;
CREATE TABLE PROJECTmaw
ProjectName VARCHAR UNIQUE NOT NULL,
ProjectNumber INT PRIMARY KEY,
ProjectLocation VARCHAR
DepartmentNumber INT,
CONSTRAINT PROJECTmawFK FOREIGN KEY DepartmentNumber REFERENCES DEPARTMENTmawDepartmentNumber;
CREATE TABLE PROJECTASSIGNMENTmaw
EmployeeSSN CHAR
ProjectNumber INT,
Hours DECIMAL NOT NULL,
CONSTRAINT PROJECTASSIGNMENTmawPK PRIMARY KEY EmployeeSSN ProjectNumber
CONSTRAINT PROJECTASSIGNMENTmawEMPFK FOREIGN KEY EmployeeSSN REFERENCES EMPLOYEEmawSSNNumber ON DELETE CASCADE,
CONSTRAINT PROJECTASSIGNMENTmawPROJFK FOREIGN KEY ProjectNumber REFERENCES PROJECTmawProjectNumber ON DELETE CASCADE;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started