From 26b1f59c82a2738a8408453db139ccff078e5ebd Mon Sep 17 00:00:00 2001 From: Colebow Date: Tue, 17 May 2022 11:43:05 -0400 Subject: [PATCH] Clarify use of expressions in UPDATE docs --- docs/src/main/sphinx/sql/update.rst | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/src/main/sphinx/sql/update.rst b/docs/src/main/sphinx/sql/update.rst index 4fad538738ef..c80d8be75912 100644 --- a/docs/src/main/sphinx/sql/update.rst +++ b/docs/src/main/sphinx/sql/update.rst @@ -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 -----------