Question
Assume the following three are true. (1) The above two tables already exist in a database with data inserted as shown above. (2) EmpID and
Assume the following three are true.
(1) The above two tables already exist in a database with data inserted as shown above.
(2) EmpID and Dname are the primary key of Employee and Department tables, respectively.
(3) There is no foreign key constraint defined to relate these two table. That's why employee E012 can have a dept value 'HR', which does not exist in Department.
Leaving current data alone (i.e., without adding or modifying or removing them out of these two tables), how would you relate Employee with Department by enforcing a foreign key constraint such that referencing a non-existing department will never happen again to any new employees? Write an ALTER TABLE statement to answer this question.
Employee Department EmpID Dept Gender Dname Office R&D K-71 Sales M-22 Sales F E012 HR E354Step 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