Delete in SQL
? DELETE Statement in SQL
The DELETE command is used to remove existing rows from a table based on a condition.
? Syntax
DELETE FROM table_nameWHERE condition;The
WHEREclause specifies which rows to delete.If you omit the WHERE clause, all rows in the table will be deleted!
? Example
Delete employees with age less than 25:
DELETE FROM employeesWHERE age < 25;? Delete All Rows
DELETE FROM employees;Deletes all rows but keeps the table structure intact.
? Notes
DELETEremoves rows one by one and can be slower on large tables.To delete all rows quickly, use
TRUNCATE TABLE(which cannot be rolled back in some DBMS).You can combine
DELETEwith transactions (COMMIT/ROLLBACK) for safe deletions.
If you want, I can show you DELETE with joins, cascading deletes, or examples for specific SQL databases!