How to use Delete Command in SQL Server?

Introduction:

In this article i will explain what is Delete command and how to use Delete command in SQL Server.

Description:

 In previous articles i explained How to create a table in SQL ServerHow to alter table column in SQL ServerHow to add a column to table and How to delete a column from table in SQL ServerHow to rename a column and How to rename a table in SQL Server, and Update Command. Now i will explain what is Delete command and how to use Delete command in SQL Server.

Here i'm using Employee table.

Delete command is used to delete particluar records from table. While deleting records we can specify conditions in where clause. Where clause is optional.

Syntax:(1)

Delete from <table-name>

Syntax:(2)

Delete from <table-name> where <column-name> = <value>

Example:

Delete from Employee where EmpNo = 4

Execute the above statement.

Output:

Important:

  • If we omit the where condition all the records will be deleted.
  • Records will be deleted in sequential manner.