UPDATE
-- simple UPDATE
UPDATE stock SET retail=25.95 WHERE isbn='0590445065';
-- updaing entire columns
UPDATE stock SET retail=(cost*((retail/cost)+0.1::numeric));
-- updating several columns
UPDATE publishers SET name='O\'Reilly & Associates', address='O\'Reilly & Associates, Inc. 101 Moriss St, Sebastopol, CA 95472' WHERE id=113;
-- update with several sources
UPDATE stock SET retail=stock_backup.retail FROM stock_backup WHERE stock.isbn=stock_backup.isbn;
UPDATE stock SET retail=25.95 WHERE isbn='0590445065';
-- updaing entire columns
UPDATE stock SET retail=(cost*((retail/cost)+0.1::numeric));
-- updating several columns
UPDATE publishers SET name='O\'Reilly & Associates', address='O\'Reilly & Associates, Inc. 101 Moriss St, Sebastopol, CA 95472' WHERE id=113;
-- update with several sources
UPDATE stock SET retail=stock_backup.retail FROM stock_backup WHERE stock.isbn=stock_backup.isbn;
'DataBase' 카테고리의 다른 글
PostgreSQL - SUB_QUERY (0) | 2009.05.02 |
---|---|
PostgreSQL - DELETE (0) | 2009.05.02 |
PostgreSQL - SELECT (0) | 2009.05.02 |
PostgreSQL - INSERT (0) | 2009.05.02 |
PostgreSQL - ALTER (6) | 2009.05.02 |