Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Error: Forgein Key Incorrectly Formed. How can I fix this regarding the SQL code below for the Dept _ Location Table. I have included the
Error: Forgein Key Incorrectly Formed. How can I fix this regarding the SQL code below for the DeptLocation Table. I have included the code for the other tables before it as well in case its needed
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 Department DepNo 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