SQL Delete Query:
The SQL Delete statement is used to delete records from a table.
DELETE FROM table_name WHERE some_column=some_value;
Here the WHERE clause specifies which record should be deleted. If we didn’t mention WHERE clause then all the records will be deleted.
DELETE FROM SCOREBOARD WHERE Playername='Dravid' AND Runs=20;
In the below screenshot, you could find the total number of records are ‘3′ related to first SELECT query where as the total number of records are just ‘2’ related to second SELECT query. We have executed the DELETE query to delete the record from ‘SCOREBOARD’ table where ‘Playername’ is equal to ‘Dravid’ and ‘Runs’ is equal to ‘20′. As per our table, we could find one record where both the conditions are matched. So that record was deleted.
Delete all the records:
We could delete all the records at a time from a particular table using the below syntax. All rows in a table will be deleted but not table.
SQL DELETE Query To Delete All The Records Syntax :
The below syntax is used to delete all the records from the specified table.
DELETE * FROM table_name;
In the next tutorial, we will see How To Use ALTER Query in SQL
Check out the complete SQL Tutorial by clicking on below link: