Saturday, 6 October 2012

Modifying data

It is possible to modify an existing table's data using SQL. There are commands for inserting new data, deleting existing data and modifying existing data.

Format
Inserting a new row of data, list of values must match order of table structure.
(You must include NULL if value is blank)
INSERT INTO table VALUES(<list of values>)l

Insert multiple rows of data at once (Not available in Microsoft Access)
INSERT INTO table VALUES (<list of values>),
                                                  (<list of values>),
                                                  (<list of values>);

Delete row of data from table
DELETE FROM table WHERE <condition>

Modify existing row's value
UPDATE table SET attribute - <new value> WHERE <condition>

No comments:

Post a Comment