UPDATE existing records

From SQLZOO
Jump to navigation Jump to search

UPDATE can change an existing record.

schema:scott
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
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects