27.07.2013 Views

Deitel - Python, How To Program.pdf

Deitel - Python, How To Program.pdf

Deitel - Python, How To Program.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pythonhtp1_17.fm Page 590 Wednesday, December 19, 2001 2:46 PM<br />

590 Database Application <strong>Program</strong>ming Interface (DB-API) Chapter 17<br />

Title ISBN<br />

First-<br />

Name<br />

Last-<br />

Name<br />

Copyright<br />

C# <strong>How</strong> <strong>To</strong> <strong>Program</strong> 0130622214 Harvey <strong>Deitel</strong> 2002 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0130895717 Paul <strong>Deitel</strong> 2001 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0130895717 Harvey <strong>Deitel</strong> 2001 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0131173340 Paul <strong>Deitel</strong> 1994 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0131173340 Harvey <strong>Deitel</strong> 1994 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0135289106 Harvey <strong>Deitel</strong> 1998 Prentice Hall<br />

C++ <strong>How</strong> to <strong>Program</strong> 0135289106 Paul <strong>Deitel</strong> 1998 Prentice Hall<br />

e-Business and e-Commerce 0130323640<br />

for Managers<br />

Harvey <strong>Deitel</strong> 2000 Prentice Hall<br />

e-Business and e-Commerce 0130323640 Kate Stein- 2000 Prentice Hall<br />

for Managers<br />

buhler<br />

e-Business and e-Commerce 0130323640<br />

for Managers<br />

Paul <strong>Deitel</strong> 2000 Prentice Hall<br />

e-Business and e-Commerce 013028419X<br />

<strong>How</strong> to <strong>Program</strong><br />

Harvey <strong>Deitel</strong> 2001 Prentice Hall<br />

e-Business and e-Commerce 013028419X<br />

<strong>How</strong> to <strong>Program</strong><br />

Paul <strong>Deitel</strong> 2001 Prentice Hall<br />

e-Business and e-Commerce 013028419X<br />

<strong>How</strong> to <strong>Program</strong><br />

Tem Nieto 2001 Prentice Hall<br />

We added indentation to the query in Fig. 17.22 to make the query more readable. Let<br />

us now break down the query into its various parts. Lines 1–3 contain a comma-separated<br />

list of the fields that the query returns; the order of the fields from left to right specifies the<br />

fields’ order in the returned table. This query selects fields Title and ISBN from table<br />

Titles, fields FirstName and LastName from table Authors, field Copyright<br />

from table Titles and field PublisherName from table Publishers. For purposes<br />

of clarity, we fully qualified each field name with its table name (e.g., Titles.ISBN).<br />

Lines 5–10 specify the INNER JOIN operations used to combine information from the<br />

various tables. There are three INNER JOIN operations. It is important to note that,<br />

although an INNER JOIN is performed on two tables, either of those two tables can be the<br />

result of another query or another INNER JOIN. We use parentheses to nest the INNER<br />

JOIN operations; SQL evaluates the innermost set of parentheses first and then moves outward.<br />

We begin with the INNER JOIN:<br />

( Publishers INNER JOIN Titles<br />

ON Publishers.PublisherID = Titles.PublisherID )<br />

Publisher-<br />

Name<br />

Fig. Fig. 17.23 17.23 Portion of the result set produced by the query in Fig. 17.22. (Part 2 of 2.)<br />

which joins the Publishers table and the Titles table ON the condition that the PublisherID<br />

numbers in each table match. The resulting temporary table contains information<br />

about each book and its publisher.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!