SQL DELETE
The DELETE command in SQL Server is a DML (Data Manipulation Language) command used to remove existing rows (records) from a table.
👉 In simple words:
DELETE removes data from a table based on a condition.
Important Points
1️. DELETE removes specific rows from a table.
2️. Always use WHERE clause to avoid deleting all records.
3️. The table structure remains intact.
4️. DELETE can be rolled back if used inside a transaction.
Basic Syntax
DELETE FROM table_name WHERE condition;
Delete a Specific Record
DELETE FROM Students WHERE Student_ID = 102;
Delete Multiple Records
DELETE FROM Students WHERE Age < 20;
Delete All Records from a Table
DELETE FROM Students; --This removes all rows, but the table structure remains.
Rollback after Delete Records
BEGIN TRANSACTION; DELETE FROM Students WHERE Student_ID = 101; ROLLBACK; --This will undo the delete operation.
Simple Definition (Exam/Interview):
DELETE is a DML command used in SQL Server to remove one or more records from a table based on a specified condition.