oracle | Page 7

Not Available
8
18 Spalding Medical Inc. 8
19 Kendall-Taylor Corp. 8
20 Malden Labs 8
21 Crimson Medical Inc. 9
22 Nichols Industries 9
23 Owens-Baxter Corp. 9
24 Jackson Medical Inc. 9
25 Worcester Technologies 9
26 Alpha Technologies 10
27 Phillips Labs 10
28 Jaztech Corp. 10
29 Madden-Taylor Inc. 10
30 Wallace Industries 10
Since we neglected to impose any conditions via a WHERE clause, our query returns
every row from the customer table.If we want to restrict the set of data returned by
the query, we could include a WHERE clause with a single condition:
SELECT cust_nbr, name, region_id
FROM customer
WHERE region_id = 8;
CUST_NBR NAME REGION_ID
---------- ------------------------------ ----------
16 Paulson Labs 8
17 Evans Supply Corp. 8
18 Spalding Medical Inc. 8
19 Kendall-Taylor Corp. 8
20 Malden Labs 8
,ch01.8459 Page 6 Wednesday, March 27, 2002 2:18 PM

This is the Title of the Book, eMatter Edition
Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.DML Statements|
7
Our result set now includes only those customers residing in the region with a
region_id of 8.But what if we want to specify a region by name instead of region_id?
We could query the region table for a particular name and then query the customer
table using the retrieved region_id.Instead of issuing two different queries, however,
we could produce the same outcome using a single query by introducing ajoin, as in:
SELECT customer.cust_nbr, customer.name, region.name
FROM customer, region
WHERE region.name = 'New England'
AND region.region_id = customer.region_id;
CUST_NBR NAME
Continue reading on your phone by scaning this QR Code

 / 210
Tip: The current page has been bookmarked automatically. If you wish to continue reading later, just open the Dertz Homepage, and click on the 'continue reading' link at the bottom of the page.