Search⌘ K

Question: Cascading Delete

Understand how to add a foreign key constraint with ON DELETE CASCADE between related tables to ensure automatic deletion of dependent records. Learn to manage and verify cascading deletes using employee and skill records. This lesson helps you handle database relationships and maintain data consistency when deleting entries.

Question

Given the following table structure of Employees and Skills:

Employees

EmpID

EmpName

Salary

1

Susan Lee

50000.00

2

Alexa Smith

60000.00

3

Sana Amberson

45000.00

4

Sarah Ronald

47000.00

Skills

SkillID

EmpID

SkillName

1

1

C++

2

4

Java

3

1

Python

4

3

Blender

5

NULL

Android

Additional information

The Employees table consists of the following columns:

  • EmpID: Unique identifier for each employee

  • EmpName: The name of the ...