MySQL DELETE
To eliminate data records from a table, the MySQL DELETE statement is used.
Syntax:
DELETE FROM table_name WHERE conditions;
Example:
Items table before deletion:
ID | NAME | QUANTITY |
1 | Electronics | 30 |
2 | Sports | 45 |
3 | Fashion | 100 |
4 | Grocery | 90 |
5 | Toys | 50 |
DELETE FROM items WHERE id = 3; |
Explanation:
The ‘items’ is an already existing table, from which we are deleting the row where id is 3.
Items table after deletion:
ID | NAME | QUANTITY |
1 | Electronics | 30 |
2 | Sports | 45 |
4 | Grocery | 90 |
5 | Toys | 50 |
Please Share