Skip to main content

Delete command in SQL

How to use DELETE Command in SQL

In this post, you will learn how to use DELETE command in SQL.

DELETE command is used to DELETE record in table. DELETE command is always used with WHERE clause. If you don't use WHERE Clause, all record will be DELETE in table so while using DELETE command, you must be carefull.

Syntax of DELETE command:

DELETE From Table_Name 
WHERE Column_Name='Values' ;


Suppose we have source table: 


Emp_ID
Emp_Name
Emp_Age
Emp_Salay
1
Mohan
25
25000
2
Rakesh
25
25000
3
Ram
25
25000


Now i'm going to update Emp_Name: Mohan to "Mahesh". Now use below code to Update existing record

DELETE FROM EMP 
WHERE Emp_ID=3;

Now after executing this code, you will get below results:

Emp_ID
Emp_Name
Emp_Age
Emp_Salay
1
Mohesh
30
25000
2
Rakesh
25
25000