Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!
Deleting data
1. Delete data


All right! Now you will learn how to delete data from the database. To delete data from a database, you use - surprise, surprise - the DELETE command.

To delete the user with id 1, type:

DELETE FROM user WHERE id = 1; 

Here, user is the name of table you're deleting from. The database removes all rows for which the WHERE condition is true. The WHERE condition can be the same as the WHERE condition in the SELECT command.

As with the UPDATE command, the database always tells you how many rows it has deleted.


Oops, we've run out of sugar! Delete all desserts from our menu.

Stuck? Here's a hint!


DELETE FROM dish WHERE type = 'dessert';