SQL DELETE Query with explanation and example

SQL DELETE Query

We can delete one or more rows in a table, SQL DELETE Query with a WHERE clause to specify a search condition and DELETE statement removes zero or more rows of a table basically it’s depending on how many rows satisfy the search condition that you specify in the WHERE clause.

General syntax

SQL DELETE Query

DELETE table-name

If I want to DELETE specific records append a WHERE clause:

DELETE table-name 
 WHERE condition

SQL DELETE Query Examples

DELETE Product
Product
Id
ProductName
SupplierId
Price
DELETE FROM Customers
WHERE CustomerName='Alfreds Futterkiste';

If you want to quickly delete all of the rows from a table, and you’re really sure that you want to do it, and you do not have foreign keys against the tables, then a TRUNCATE is probably going to be faster than a DELETE.

Resource
SQL