How to delete rows

Delete matching rows

DELETE FROM removes complete rows selected by WHERE.

DELETE FROM enrollments
WHERE student_id = 7
  AND course_id = 3;

Preview first

Use a SELECT with the same condition and confirm exactly which rows match.

SELECT *
FROM enrollments
WHERE student_id = 7 AND course_id = 3;

Respect relationships

Foreign keys may reject deletion, cascade it to child rows, or clear optional references according to the schema.

Protect broad deletes

Without WHERE, every row is removed. Use a transaction so you can inspect the effect and roll back a mistake before committing.