In the previous chapter, we discussed the T-SQL’s Update statement. Now, in this chapter, we are going to discuss how we can use T-SQL’s DELETE command to delete records from a table in SQL Server. We will also discuss some best practices we need to follow while using the DELETE command in MS SQL Server.
What is DELETE command
DELETE command is used to delete/remove existing records from a SQL table. Depending on the need, we can delete all or a few selected records from a table. If required, we can delete the records in a table based on the records which exist in other tables. However, in this case, we need to join all the table(s) in the FROM clause of the DELETE statement. Let’s have a look at the syntax of the DELETE statement:
Syntax of DELETE command in SQL Server
To delete all the records in … More