SQL Delete

SQL Delete

The SQL command DELETE is used to delete records from an SQL table.
You can delete all records from table or just certain records that meet the required conditions.

Delete syntax

-- delete all records from table
DELETE FROM table_name

--deletes the records that meet the condition
DELETE FROM table_name WHERE {condition}

--deletes the records that meet both conditions
DELETE FROM table_name WHERE {condition} AND {condition}

Delete example

DELETE FROM coder_books;

DELETE FROM coder_books WHERE id=3;

DELETE FROM coder_books 
WHERE price > 20 
AND title LIKE '%SQL%';