Delete MySQL Tables

Delete MySQL tables data using Delete query.


Delete Statement :

The delete statement is used to delete the values from a table.

Syntax :

DELETE FROM tbl_name [WHERE where_condition];

The Delete statement deletes the rows from tbl_name and returns the number of rows deleted. The WHERE clause is used to specify the conditions that identify which rows to be deleted. If the DELETE query contains without WHERE clause, all rows will be deleted.

Example :

mysql> delete from student where name='michael';
Query OK, 1 row affected (0.00 sec)
This is an example of delete statement The above example will delete the record of the student Michael from the table.
We can also delete mysql tables all values as the following query.
mysql> delete from student;
Query OK, 8 rows affected (0.00 sec)
This simple delete query used to delete all data in a table.

Ask Questions

Ask Question