1.8. Updates

You can update existing rows using the UPDATE command. Suppose you discover that all the employees hired after January 25, 1984 have their salaries offset by 100. Then you may update the data as follows:

UPDATE emp
SET sal = sal + 100
WHERE hiredate > TO_DATE('1984-01-25','YYYY-MM-DD');

Look at the new state of the data:

SELECT * FROM emp
WHERE hiredate > TO_DATE('1984-01-25','YYYY-MM-DD');

 empno | ename |   job   | mgr  |  hiredate  |   sal   | comm | deptno
-------+-------+---------+------+------------+---------+------+--------
  7788 | SCOTT | ANALYST | 7566 | 1987-04-19 | 3000.00 |      |     20
  7876 | ADAMS | CLERK   | 7788 | 1987-05-23 | 1100.00 |      |     20
(2 rows)