Skip to content

Commit

Permalink
Clarify use of expressions in UPDATE docs
Browse files Browse the repository at this point in the history
  • Loading branch information
colebow authored and electrum committed May 20, 2022
1 parent 29770ae commit b533974
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions docs/src/main/sphinx/sql/update.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,34 @@ Examples

Update the status of all purchases that haven't been assigned a ship date::

UPDATE purchases SET status = 'OVERDUE' WHERE ship_date IS NULL;
UPDATE
purchases
SET
status = 'OVERDUE'
WHERE
ship_date IS NULL;

Update the account manager and account assign date for all customers::

UPDATE customers SET
UPDATE
customers
SET
account_manager = 'John Henry',
assign_date = DATE '2007-01-01';
assign_date = now();

Update the manager to be the name of the employee who matches the manager ID::

UPDATE
new_hires
SET
manager = (
SELECT
e.name
FROM
employees e
WHERE
e.employee_id = new_hires.manager_id
);

Limitations
-----------
Expand Down

0 comments on commit b533974

Please sign in to comment.