Day 7

Quiz

1: In the section “Nesting Subqueries,” the sample subquery returned several values:
LE SHOPPE
BIKE SPEC
LE SHOPPE
BIKE SPEC
JACKS BIKE

Some of these are duplicates. Why aren't these duplicates in the final result set?

A1: The result set has no duplicates because the query that called this subquery
SELECT ALL C.NAME, C.ADDRESS, C.STATE,C.ZIP
FROM CUSTOMER C
WHERE C.NAME IN

returned only the rows where NAME was in the list examined by the statement IN. Don't confuse this simple IN with the more complex JOIN.

2: Are the following statements true or false?
  1. The aggregate functions SUM, COUNT, MIN, MAX, and AVG all return multiple values.

  2. The maximum number of subqueries that can be nested is two.

  3. Correlated subqueries are completely self-contained. ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.