Answer: The FOREIGN KEY Constraint
Explore how to apply the FOREIGN KEY constraint in SQL to ensure data consistency between related tables. Learn to modify table structures, add or drop foreign keys, and understand their role in preventing invalid data. This lesson equips you with the skills needed to handle foreign key constraints confidently.
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 ...