The SQL DELETE Query is used to delete the existing records from a table. You can use WHERE clause with DELETE query to delete selected rows, otherwise all the records would be deleted.
Syntax: The basic syntax of DELETE query with WHERE clause is as follows:
DELETE FROM table_name WHERE [condition];
You can combine N number of conditions using AND or OR operators.
Example: Consider the DEPT table having the following records:
Following is an example, which would DELETE a dept record, whose deptno is 10:
DELETE FROM DEPT WHERE DEPTNO = 10;
Now, DEPT table would have the following records:
If you want to DELETE all the records from DEPT table, you do not need to use WHERE clause and DELETE query would be as follows:
DELETE FROM DEPT;
Now, CUSTOMERS table would not have any record.