The DELETE Statement

Contact Us or call 1-877-932-8228
The DELETE Statement

The DELETE Statement

  • A DELETE statement is used to remove data from a table.
  • A DELETE statement can be used to remove all of the rows from a table, but the TRUNCATE table statement is often preferable for this purpose.

Code Sample:

SQL-Data-Manipulation-Language/Demos/delete.sql
SELECT * 
FROM regions 
WHERE region_name LIKE 'A%a%a';

--Use of the SELECT statement to limit the rows deleted...
DELETE FROM regions 
WHERE region_id IN (
	SELECT region_id 
	FROM regions 
	WHERE region_name LIKE 'A%a%a'
);

The criteria used in the initial query can be used to construct a DELETE statement using an IN clause in the case of complex queries.

Next