If you want to delete a row of the table, you use the DELETE statement for it. This statement deletes the entire row. But if you want to delete the row without deleting its data, then you should use the TRUNCATE statement for it. You will be told about this statement further.
With the DELETE statement you use WHERE clause. If you do not use WHERE clause, all the rows of the table are deleted. With WHERE clause you can define the row you want to delete.
The general syntax of the DELETE statement is given below.
mysql> DELETE FROM table_name WHERE column_name = value;
Let’s now try to understand the DELETE statement with an example. If you want to delete a row out of the rows inserted above, then you can do this as follows.
mysql> delete from category WHERE id = 5;
If the above query is executed the first row of the category table will be deleted.