The DELETE command removes rows from your table.

Delete a Single Row

DELETE FROM users WHERE id = 4;

What this does:

  • DELETE FROM users = tells MySQL to remove data from the users table
  • WHERE id = 4 = only delete the row where id is 4

Important: Always use a WHERE clause with DELETE. Without it, you would delete ALL rows in the table.

Check Your Changes

After running the DELETE command, use SELECT * FROM users; to see your table now has one less row:

id username email
1 alice_smith alice.smith@example.com
2 bob bob@newdomain.com
3 charlie charlie@newdomain.com

Note: The id numbers don’t change - if you delete id 4, the next new user will still get id 5, not 4.

What Happens When You Delete

  • The row is permanently removed from the table
  • You cannot undo a DELETE (unless you have backups)
  • The AUTO_INCREMENT counter doesn’t reset - new rows will get the next available number

Tags: