w3resource logo

:

SQL Tutorial

SQL Delete

SQL Delete records from a table

The SQL DELETE command is used to delete rows or records from a table.

Sample tables associated with this page have shown bellow:

Sample table: daysorder


Sample table: customer1


To remove all rows from the table 'daysorder', the following SQL statement can be used :

DELETE FROM daysorder;

Output:

Sql select re-ordering columns

SQL deleting records with where

In this page, we are going to discuss, how the WHERE clause along with SQL DELETE command can be used to remove number of rows against some conditions.

Example:

To remove rows from the table 'customer1' with the following condition -

1. 'cust_country' must be 'Canada',

the SQL statement can be used:

SQL Code

DELETE FROM customer1
    WHERE cust_country='Canada';

Output:

Sql select re-ordering columns

See our Model Database