SQL DELETE Statement

In previous chapters, we described how to select, insert, update data in database tables. This chapter describes how to delete the existing data from database table.

DELETE statement is used to delete the rows from the database tables. This will delete entire row from a table, not any single cell or column.

SQL DELETE statement syntax

Type 1:

DELETE FROM tableName;

Type 2:

DELETE * FROM tableName;

This will delete all the rows from your database table i.e tableName. If you want to delete specific row then you can use WHERE clause in this DELETE statement.

SQL DELETE statement syntax with where clause

DELETE FROM table_name 
WHERE column_name1 = value;

Note: While deleting the records you must careful because once data is deleted can't be recovered Untill and unless transactions are not used.


Type 1:

DELETE * FROM dbo.Employee;

Type 2:

DELETE * FROM dbo.Employee;

SQL DELETE statement with where clause 

DELETE * FROM dbo.Employee  
where Designation='Software Engineer';

Above query will remove all the employees whose designation is Software Engineer from Employee table.

Share this chapter
comments powered by Disqus


Social Media