SQL Delete Command


Prev Tutorial Next Tutorial

SQL Delete Command

Delete command is used to delete the record from the table.

  • Using Delete command you can delete all the records from the table without delete table.
  • Using Delete command you can delete specific records from the table "using where clause"

Syntax

	
DELETE FROM table_name
WHERE some_column=some_value;

Employee table

emp_idnamesalary
101Amit24000
102Rahul34000
103Sultan54000
104Gaurav26000
105Hitesh35000

Example

DELETE FROM Employee
WHERE salary<30000;

Result after Execute above query.

emp_idnamesalary
102Rahul34000
103Sultan54000
105Hitesh35000

Difference between truncate and delete

TruncateDelete
1It is DDL CommandIt is DML Command
2It is used for permanent deletion.It is used for temporary deletion.
3We can not delete the specific record.We can delete the specific records.

Delete all record

You can also delete all the record from a table without deleting table.

Syntax

	
DELETE FROM table_name
or
DELETE * FROM table_name;

Example

DELETE FROM Employee
emp_idnamesalary
   

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements