|
DELETE Statement :
The deleting query is used to delete the values from a table.
The syntax is
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 statement contains without WHERE clause, all rows will be deleted.
Now lets see an example for DELETE statement.
mysql> delete from student where name='michael';
Query OK, 1 row affected (0.00 sec)
The above example will delete the record of the student Michael from the table.
We can also delete all the values in the table as the following query.
mysql> delete from student;
Query OK, 8 rows affected (0.00 sec)
The above example will delete all the records from the student table.
|