Loading, please wait...

Delete Query

How To Use Delete Query In SQL

 

Introduction:
In this article, you will learn what delete query is and how to use delete query in SQL.


Delete query is used to delete the current data in the table. We can also delete the data with the combination of AND or OR operators according to our requirement. This statement does not delete the design of the table; it deletes only the records, which are is present in the table. We deleted selected rows and all records of the data.

 

Syntax

The basic syntax of delete query with where clause is as follows:

delete from table_name where [condition];

 

Example

Step 1: We write our query.

 

 

 

Step 2: Consider the employee table, having the following records:

 



 

We would delete a customer, whose ID is 3:

And then after the deletion, our output is-

 



 

Delete all Records

If we delete all the data from any table, there is no not need to use where clause. The basic syntax to delete all the data is as follows-

delete from table_name;

 

Step 1 : Now, we write our query to delete all the records in one time.

 

 

 

Step 2 : And the output is-

 



 

Summary:

Thus, we learned that delete query is used to delete the data in SQL.