SQL Delete – SQL TUTORIAL | Software Testing Material

SQL Delete Query:

The SQL Delete statement is used to delete records from a table.

Syntax:

Here the WHERE clause specifies which record should be deleted. If we didn’t mention WHERE clause then all the records will be deleted.

Example:

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.

SQL Delete

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.

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:

SQL Tutorial – Complete

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap