MySQL Delete Query:
There are times when some data is not needed any longer and may even pose problems by remaining in the database. To discard unwanted data from a database, we will use the DELETE Query, which allows you to delete one or more records in a table: The Syntax of MySQL Delete Query is:
DELETE FROM table_name [WHERE Clause] |
The DELETE Query deletes the rows from table_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 a WHERE clause, all rows will be deleted.
Sample Table:
![MySQL Delete Query 2 MySQL Sample Table for Delete Query](https://gkscientist.com/wp-content/uploads/2022/11/MySQL-Sample-Table-for-Delete-Query.png)
Example 1: Delete 3rd StudentId from the table.
![MySQL Delete Query 3 MySQL Delete Query Example](https://gkscientist.com/wp-content/uploads/2022/11/MySQL-Delete-Query-Example.png)
Example 2: Delete the 7th, 8th, and 9th StudentId from the table.
![MySQL Delete Query 4 MySQL Delete Query Example to delete multiple rows](https://gkscientist.com/wp-content/uploads/2022/11/MySQL-Delete-Query-Example-to-delete-multiple-rows.png)
Comments (No)