GISQ: Tutorial Two
A Gentle
Introduction
to
SQL
Tutorial Two
Notes 1
Fantasy World Factbook
UPDATE, INSERT and DELETE
UPDATE, INSERT and DELETE are data manipulation commands.
COMMIT and ROLLBACK may be used to confirm and undo changes made using
DML commands. The command ROLLBACK will "undo" changes made up until
the most recent COMMIT.
The UPDATE command allows the field values of existing records
to be altered. The following command should add one to the population
of 'United Kingdom'. Before executing the UPDATE we COMMIT so that
we can reverse the change.
COMMIT;
UPDATE fantasy
SET population = population+1
WHERE name='United Kingdom';
You can check that it worked by issuing the following. (In case
you forgot to check the population used to be 58295119.)
SELECT population FROM fantasy WHERE name='United Kingdom'
Check that ROLLBACK reverses the change.
ROLLBACK;
SELECT population FROM fantasy WHERE name='United Kingdom'
Wyszukiwarka
Podobne podstrony:
tut2 2Tut2TUT2tut2 3tut2 1tut2tut2 3tut2 2tut2 1więcej podobnych podstron