Learn how to SQL DELETE statement and delete rows of a table. Find out how to delete specified data or all data of a table using SQL DELETE statement.

Sometimes, you need to delete rows of a table when not required for the table of your database. Deleting record of a table can be useful to maintain the accuracy of a table.

You can delete a single record or multiple records of a table using the syntax given below.

How to Use SQL DELETE Statement to Delete Rows of a Table

There are two syntaxes of SQL DELETE statement to delete data of a table. To delete only the specified record of a table, you need to use the WHERE conditional statement to delete the required record. If you do not specify the WHERE condition, the above statement deletes all the data of a table.

Syntax1: Delete Specified Data of a Table.

The above syntax deletes only the specified data of a table in the WHERE condition. You have to specify only the table name and the condition by which the required record gets deleted using the DELETE statement.

Syntax2: Delete All Data of a Table.

The above syntax deletes all the data of a table. Be careful before using this syntax as you may lose all the data of a table which is not reversible.

Parameter Descriptions

Sr.No Parameter Name Description
1 tablename Specify the table name from which you want to delete the data of a table.
2 condition Specify the condition by which only the specified record of a table gets deleted.

Examples to Use SQL DELETE Statement

You must also learn.

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.