MySQL DELETE:
The MySQL DELETE statement is used to eliminate data records from a table.
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 existing table, from which we delete the row where the id is 3.
Items table after deletion:
ID | NAME | QUANTITY |
1 | Electronics | 30 |
2 | Sports | 45 |
4 | Grocery | 90 |
5 | Toys | 50 |