UPDATE existing records

Revision as of 10:14, 17 July 2012 by Marek (talk | contribs) (Created page with "UPDATE can change an existing record. <div class='ht'> <div class=params>schema:scott</div> <div> </div> <source lang=sql class='tidy'>DROP TABLE t_peep;</source> <source lan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

UPDATE can change an existing record.

DROP TABLE t_peep;
CREATE TABLE t_peep (id INTEGER, name VARCHAR(10));
INSERT INTO t_peep VALUES (1, 'Andrew');
INSERT INTO t_peep VALUES (2, 'Gordon');
UPDATE t_peep
  SET name = 'andy', id=39
  WHERE id=1;
SELECT * FROM t_peep