Answer: The FOREIGN KEY Constraint
Explore how to apply the FOREIGN KEY constraint in SQL to maintain referential integrity between tables. Learn to modify existing tables, set foreign keys with REFERENCES, and manage constraints effectively through examples and quizzes.
Solution
The solution is given below:
Explanation
The explanation of the solution code is given below:
Lines 2–3: The
ALTER TABLEstatement makes changes in the structure of theSkillstable. It modifies theEmpIDcolumn to beNOT NULL. ANULLvalue in this column can lead to orphaned rows, which can cause inconsistency and data integrity issues.Lines 6–7: The
ALTER TABLEstatement makes changes in the structure of theSkillstable. It sets theEmpIDcolumn in the ...