Difference between revisions of "UPDATE"
Jump to navigation
Jump to search
Line 18: | Line 18: | ||
</td><td> | </td><td> | ||
<table style='float:left' class='Bordered'> | <table style='float:left' class='Bordered'> | ||
− | <caption align='center'>''' | + | <caption align='center'>'''number'''</caption> |
<tr><th align='center'>'''yr'''</th><th align='center'>'''city'''</th></tr> | <tr><th align='center'>'''yr'''</th><th align='center'>'''city'''</th></tr> | ||
− | <tr><td>2000</td><td align='left'> | + | <tr><td>2000</td><td align='left'>1</td></tr> |
− | <tr><td>2004</td><td align='left'> | + | <tr><td>2004</td><td align='left'>2</td></tr> |
− | <tr><td>2008</td><td align='left'> | + | <tr><td>2008</td><td align='left'>3</td></tr> |
− | <tr><td>2012</td><td align='left'> | + | <tr><td>2012</td><td align='left'>4</td></tr> |
</table> | </table> | ||
</table> | </table> |
Revision as of 15:36, 6 May 2014
UPDATE
The table games
shows the year and the city hosting the Olympic Games.
|
The table games
shows the year and the city hosting the Olympic Games.
|
schema:scott
DROP TABLE games
CREATE TABLE games(
yr INTEGER,
city VARCHAR(20));
INSERT INTO games VALUES (2000,'Sydney');
INSERT INTO games VALUES (2004,'Athens');
INSERT INTO games VALUES (2008,'Beijing');
INSERT INTO games VALUES (2009,'London');
The UPDATE statement can be used to change a values in rows that already exists. In this example we move the 2012 games from London to Paris.
UPDATE scott.games SET city='Paris' WHERE yr = 2012;
SELECT * FROM scott.games;
UPDATE games SET city='Paris' WHERE yr = 2012;
SELECT * FROM games;
See also