5 questions to test your understanding
A developer runs: DELETE FROM orders WHERE customer_id IN (SELECT id FROM customers WHERE status = 'inactive'). The orders table has a foreign key referencing the order_items table with ON DELETE CASCADE. What happens?
What does a bare DELETE FROM employees statement (no WHERE clause) do?
Running SELECT first with the same WHERE clause you plan to use in DELETE is a best practice because it lets you preview exactly which rows will be removed before committing to the deletion.
If a DELETE statement's WHERE clause matches zero rows, the database returns an error indicating no rows were affected.
Why is batched deletion (deleting in chunks) preferred over a single large DELETE when removing millions of rows from a production table?