Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify use of expressions in UPDATE docs #12438

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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::
colebow marked this conversation as resolved.
Show resolved Hide resolved

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

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