|
Sometimes we may wish to get rid of records from a table. To do so, we can use the DELETE FROM command. The syntax for this is
DELETE FROM "table_name"
WHERE {condition}
It is easiest to use an example. Say we currently have a table as below:
Table Store_Information
| store_name |
Sales |
Date |
| Los Angeles |
$1500 |
Jan-05-1999 |
| San Diego |
$250 |
Jan-07-1999 |
| Los Angeles |
$300 |
Jan-08-1999 |
| Boston |
$700 |
Jan-08-1999 |
and we decide not to keep any information on Los Angeles in this table. To accomplish this, we type the following SQL:
DELETE FROM Store_Information
WHERE store_name = "Los Angeles"
Now the content of table would look like,
Table Store_Information
| store_name |
Sales |
Date |
| San Diego |
$250 |
Jan-07-1999 |
| Boston |
$700 |
Jan-08-1999 |
Advanced SQL >>
Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.
Copyright 1999-2009 1keydata.com. All Rights Reserved. Privacy Policy
|