Database Reference
In-Depth Information
The following query displays the customer number, last name, and first name of all customers that are
represented by sales rep 65 or that have orders or both:
356
SELECT CustomerNum, CustomerName
FROM Customer
WHERE RepNum ¼' 35 '
UNION
SELECT Customer.CustomerNum, CustomerName
FROM Customer, Orders
WHERE Customer.CustomerNum=Orders.CustomerNum
;
UPDATE
Use the UPDATE command to change the contents of one or more rows in a table. Figure B-15 describes the
UPDATE command.
Clause
Description
Required?
UPDATE table name
Indicates the name of the table whose contents
will be changed.
Yes
SET
column = expression
Indicates the column to be changed, along with
an expression that provides the new value.
Yes
WHERE condition
Indicates a condition. The change will occur
only on those rows for which the condition is true.
No (If you omit the WHERE
clause, all rows will be updated.)
FIGURE B-15
UPDATE command
The following UPDATE command changes to 1445 Rivard the street address on the row in the Customer
table on which the customer number is 524:
UPDATE Customer
SET Street ¼' 1445 Rivard '
WHERE CustomerNum ¼' 524 '
;
Search WWH ::




Custom Search