Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how can i solve this error SQLQueryLAB2.sql...PUTERNavne (84))* X GCREATE DATABASE COMPANY; GALTER TABLE EMPLOYEE ADD FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN), FOREIGN KEY (DNUMBER) REFERENCES
how can i solve this error
SQLQueryLAB2.sql...PUTER\Navne (84))* X GCREATE DATABASE COMPANY; GALTER TABLE EMPLOYEE ADD FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN), FOREIGN KEY (DNUMBER) REFERENCES DEPARTMENT(DNUMBER); FCREATE TABLE EMPLOYEE(FNAME VARChAR(20) NOT NULL, Minit CHAR(1), LNAME VARChAR(30) NOT NULL, SSN CHAR(9) NOT NULL UNiQue, BDATE VARCHAR(25) , ADDRESS VARCHAR(50), SEX CHAR(10), SALARY INT, SUPERSSN CHAR(9), DNO INT NOT NULL, PRIMARY KEY(SSN)); INSERT INTO EMPLOYEE VALUES('John', 'B', 'Smith', '123456789', '09-Jan-55', '731 Fondren, Houston, TX', 'M', 30000, '987654321', 5); INSERT INTO EMPLOYEE VALUES('Franklin', 'T', 'Wong', '333445555', '08-Dec-45', '638 Voss, Houston, TX', 'M', 40000, '888665555', 5); INSERT INTO EMPLOYEE VALUeS('Joyce', 'A', 'English', '453453453', '31-Jul-62', '5631 Rice, Houston, TX', 'F', 25000, '333445555', 5); INSERT INTO EMPLOYEE VALUES('Ramesh', 'K', 'Narayan', '666884444', '15-Sep-52', '975 Fire Oak, Humble, TX', 'M', 38000, '333445555', 5); INSERT INTO EMPLOYEe ValueS('James', 'E', 'Borg', '888665555', '10-Nov-27', '450 Stone, Houston, TX', 'M', 55000, 'NULL', 1); INSERT INTO EMPLOYEE VALUES('Jennifer', 'S', 'Wallace', '987654321', '20-Jun-31', '291 Berry, Bellaire, TX', 'F', 43000, '888665555', 4); INSERT INTO EMPLOYEE VALUES('Ahmad', 'V', 'Jabbar', '987987987', '29-Mar-59', '980 Dallas, Houston, TX', 'M', 25000, '987654321', 4); INSERT INTO EMPLOYEE VALUES('Alicia', 'J', 'Zelaya', '999887777', '19-Jul-58', '3321 Castle, SPring, TX', 'F', 25000, '987654321', 4); GALTER TABLE DEPARTMENT ADD CONSTRAINT FKMGRSSNPKSSN FOREIGN KEY (MGRSSN) REFERENCES EMPLOYEE(SSN) CREATE TABLE DEPARTMENT (DNAME VARCHAR(20) NOT NULL UNIQUE, DNUMBER INT NOT NULL UNIQUe, MGRSSN CHAR(9) NOT NULL, MGRSTARTDATE VARCHAR(20), PRIMARY KEY (DNUMBER INSERT INTO DEPARTMENT VALUES('Headquarters', 1,888665555, '19-Jun-71'); INSERT INTO DEPARTMENT VALUES('Administration', 4, 987654321, ' 01-Jan-85'); INSERT INTO DEPARTMENT VALUES('Research ', 5, 333445555, '22-May-78'); INSERT INTO DEPARTMENT VALUES('Automation', 7, 123456789, '06-0ct-05'); Messages Msg 1769, Level 16 , State 1 , Line 2 Foreign key 'DNUMBER' references invalid column 'DNUMBER' in referencing table 'EMPLOYEE'. Msg 1750, Level 16, State 0 , Line 2 Could not create constraint or index. See previous errors. Completion time: 2023-03-01T21:47:54.7594319-05:00Step 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