SQL Tutorial
|
|
|
|
| Articles Reviews Structured Query Language | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Written by Bogdan V | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Thursday, 14 September 2006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Page 15 of 17 {mos_sb_discuss:29} Once there's data in the table, we might find that there is a need to modify the data. To do so, we can use the UPDATE command. The syntax for this is
UPDATE "table_name" For example, say we currently have a table as below: Table Store_Information
and we notice that the sales for Los Angeles on 01/08/1999 is actually $500 instead of $300, and that particular entry needs to be updated. To do so, we use the following SQL:
UPDATE Store_Information The resulting table would look like Table Store_Information
In this case, there is only one row that satisfies the condition in the WHERE clause. If there are multiple rows that satisfy the condition, all of them will be modified. It is also possible to UPDATE multiple columns at the same time. The syntax in this case would look like the following:
UPDATE "table_name" SQL DELETE FROM Statement 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" It is easiest to use an example. Say we currently have a table as below: Table Store_Information
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 Now the content of table would look like, Table Store_Information
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Last Updated ( Saturday, 30 June 2007 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < Prev |
|---|







