Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CREATE TABLE employee_work (
workid int(10) NOT NULL AUTO_INCREMENT Primary KEY,
eid int,
complaintid int,
compliant_status enum('completed','inprogress','stuck') NOT NULL,
reply text NOT NULL,
FOREIGN KEY (compliantid) REFERENCES complaints(complaintid),
FOREIGN KEY (eid) REFERENCES employee_login(eid)
);


MySQL said: Documentation

#1072 - Key column 'compliantid' doesn't exist in table

What I have tried:

foreign key reference is given but error..
Posted
Updated 28-Dec-21 22:21pm

1 solution

Spelling is important:
SQL
CREATE TABLE employee_work (
...
complaintid int,
...
FOREIGN KEY (compliantid) REFERENCES complaints(complaintid),

complaintid is not the same as compliantid
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900