BackendQuestion 20 of 52
ON DELETE CASCADE
Problem
When an employee leaves the company and their record is deleted, the application throws foreign key constraint errors because they still have associated profile settings. You need the database to automatically delete the profile when the employee is deleted. Create a table profiles with an id INT, and an employee_id INT that references employees(employee_id) with ON DELETE CASCADE.
Database Schema
This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.
Try It
Loading playground environment...