DELETE QueryThe DELETE Query in T-SQL is used to delete the existing records, which we want to remove from the table. We use the WHERE clause with DELETE command to delete the rows that we have selected to delete. Otherwise the record is deleted. Syntax:- We combine N number of condition using the AND or OR operators. Example:Consider the EMPLOYEES table which has the following records-
Example 1:Below command is an example of DELETE an EMPLOYEES record, whose ID is 006- EMPLOYEES table will have the below records:
Example 2-Below command is an example of DELETE an EMPLOYEES record, who's Name is RAHUL- Output:
If we DELETE all the records from the EMPLOYEES table, we don't need to use the WHERE clause. DELETE query will be as follows ? EMPLOYEES table now will not have any record. Next TopicT-SQL WHERE Clause |