Professional Documents
Culture Documents
Guide To SQL 9th Edition Pratt Test Bank 1
Guide To SQL 9th Edition Pratt Test Bank 1
3. To ensure that query results are listed in a desired order, use the ORDER BY clause.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 133
4. To relate two tables, in the FROM clause list all columns involved in the query.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 134
5. You must join tables by finding rows in the two tables that have identical values in matching columns.
a. True
b. False
ANSWER: True
POINTS: 1
Cengage Learning Testing, Powered by Cognero Page 1
Chapter 5: Multiple-Table Queries
REFERENCES: 134
8. You can use the EXISTS operator to retrieve data from more than one table.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 138
9. You can use the IN operator to retrieve data from multiple tables.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 138
12. In small databases, there is a significant time difference between different query approaches.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 141
13. When using a DBMS without an optimizer, the formulation of a query can make a difference in the speed with which
the query is executed.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 141
14. You must use a comma or a period to separate a table name from its alias.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 142
16. One reason for using an alias is when you are joining a table to itself.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 143
18. You can join three tables together but not four tables.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 147
19. For two tables to be union compatible, the columns of the two tables must be identical.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 151
21. To produce the same results as the INTERSECT operator, use the BETWEEN operator and a subquery.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 152
22. To produce the same results as the MINUS operator, use NOT, the IN operator and a subquery.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 153
24. You can use the ALL and ANY operators with subqueries to produce a single column of numbers.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 154
Cengage Learning Testing, Powered by Cognero Page 4
Chapter 5: Multiple-Table Queries
25. You can perform special operations, such as self-joins, within SQL.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 157
27. In a full outer join, all rows from both tables will be included regardless of whether they match rows from the other
table.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 158
29. It is easy to create a product inadvertently by omitting the WHERE clause when you are attempting to join tables.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 159
30. Table A has 10 rows and table B has 7 rows. The product of Table A and Table B would have 70 rows.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 160
Multiple Choice
31. You can join tables by using a condition in the ____ clause.
Cengage Learning Testing, Powered by Cognero Page 5
Chapter 5: Multiple-Table Queries
a. FROM
b. WHERE
c. SELECT
d. JOIN
ANSWER: b
POINTS: 1
REFERENCES: 134
32. To qualify a column name, precede the name of the column with the name of the table, followed by a(n) ____.
a. comma (,)
b. period (.)
c. percent sign (%)
d. asterisk (*)
ANSWER: b
POINTS: 1
REFERENCES: 134
33. To retrieve data from multiple tables in a query you can use the ____ operator with a subquery.
a. AND
b. IN
c. OR
d. NOT
ANSWER: b
POINTS: 1
REFERENCES: 138
34. You can precede a subquery with the ____ operator to create a condition that is true if one or more rows are obtained
when the subquery is executed.
a. IS NULL
b. IS TRUE
c. IS EXIST
d. EXISTS
ANSWER: d
POINTS: 1
REFERENCES: 139
35. When a subquery involves a table listed in the outer query, the subquery is called a(n) ____ subquery.
a. inner outer
b. correlated
c. reverse
d. parameter
ANSWER: b
POINTS: 1
REFERENCES: 139
37. You create an alias by typing the name of the table, pressing the ____, and then typing the name of the alias.
a. Tab
b. Backspace
c. Enter
d. Spacebar
ANSWER: d
POINTS: 1
REFERENCES: 142
38. The ____ of two tables is a table containing every row that is in either the first table, the second table, or both tables.
a. intersection
b. union
c. minus
d. difference
ANSWER: b
POINTS: 1
REFERENCES: 150
39. The ____ of two tables is a table containing all rows that are in both tables.
a. intersect
b. union
c. difference
d. minus
ANSWER: a
POINTS: 1
REFERENCES: 150
40. The ____ of two tables is the set of all rows that are in the first table but that are not in the second table.
a. union
b. intersect
c. intersection
d. difference
ANSWER: d
POINTS: 1
REFERENCES: 150
Cengage Learning Testing, Powered by Cognero Page 7
Chapter 5: Multiple-Table Queries
41. Two tables are ____ compatible if they have the same number of columns and if their corresponding columns have
identical data types and lengths.
a. union
b. minus
c. difference
d. intersect
ANSWER: a
POINTS: 1
REFERENCES: 151
42. For an SQL implementation to truly support the union operation, it must remove ____ rows automatically.
a. dependent
b. no
c. independent
d. duplicate
ANSWER: d
POINTS: 1
REFERENCES: 152
43. Oracle and SQL Server support the ____ operator but Microsoft Access does not.
a. UNION
b. INTERSECT
c. MINUS
d. ALL
ANSWER: b
POINTS: 1
REFERENCES: 153
44. If you precede the subquery by the ____ operator, the condition is true only if it satisfies all values produced by the
subquery.
a. TRUE
b. ALL
c. IS ALL
d. ALWAYS
ANSWER: b
POINTS: 1
REFERENCES: 154
45. If you precede the subquery by the ____ operator, the condition is true only if it satisfies any value (one or more)
produced by the subquery.
a. IS SOME
b. IS ANY
c. SOME
d. ANY
ANSWER: d
POINTS: 1
REFERENCES: 154
46. Which of the following joins compares the tables in the FROM clause and lists only those rows that satisfy the
condition in the WHERE clause?
a. inner
b. outer
c. nested
d. product
ANSWER: a
POINTS: 1
REFERENCES: 157
47. In a(n) ____ join, all rows from both tables are included regardless of whether they match rows from the other table.
a. normal
b. inner
c. full outer
d. combined
ANSWER: c
POINTS: 1
REFERENCES: 158
48. In a ____, all rows from the table on the left (the table listed first in the query) will be included regardless of whether
they match rows from the table on the right (the table listed second in the query).
a. left inner join
b. left outer join
c. right inner join
d. right outer join
ANSWER: b
POINTS: 1
REFERENCES: 158
49. The product of two tables is formally called the ____ Product.
a. Oracle
b. Outer
c. SQL
d. Cartesian
ANSWER: d
POINTS: 1
REFERENCES: 159
50. In a ____, all rows from the table on the right will be included regardless of whether they match rows from the table
on the left.
a. left inner join
Completion
51. To retrieve data from more than one table, you must ____________________ the tables together by finding rows in
the two tables that have identical values in matching columns.
ANSWER: join
POINTS: 1
REFERENCES: 134
52. You join tables in SQL by including a condition in the ____________________ clause to ensure that matching
columns contain equal values.
ANSWER: WHERE
POINTS: 1
REFERENCES: 134
53. When there is potential ambiguity in listing column names, you must ____________________ the columns involved
in the query.
ANSWER: qualify
POINTS: 1
REFERENCES: 135
54. The subquery that involves a table listed in the outer query is called a(n) ____________________ subquery.
ANSWER: correlated
POINTS: 1
REFERENCES: 139
56. SQL performs many built-in ____________________ that analyze queries to determine the best way to satisfy them.
ANSWER: optimizations
POINTS: 1
REFERENCES: 141
57. When tables are listed in the FROM clause, you can give each table a(n) ____________________, or an alternate
name.
ANSWER: alias
POINTS: 1
REFERENCES: 142
Cengage Learning Testing, Powered by Cognero Page 10
Chapter 5: Multiple-Table Queries
59. If you had two separate tables for customers and the query requested customers in the first table having the same city
as customers in the second table, you could use a normal ____________________ operation to find the answer.
ANSWER: join
POINTS: 1
REFERENCES: 144
60. In a multiple-table query, you list all the desired columns in the ____________________ clause and qualify any
columns that appear in more than one table.
ANSWER: SELECT
POINTS: 1
REFERENCES: 149
61. The ____________________ of two tables is a table containing every row that is in either the first table, the second
table, or both tables.
ANSWER: union
POINTS: 1
REFERENCES: 150
62. The ____________________ of two tables is a table containing all rows that are in both tables.
ANSWER: intersection
intersect
POINTS: 1
REFERENCES: 150
63. The ____________________ of two tables is the set of all rows that are in the first table but that are not in the second
table.
ANSWER: difference
minus
POINTS: 1
REFERENCES: 150
64. Two tables are ____________________ compatible if they have the same number of columns and if their
corresponding columns have identical data types and lengths.
ANSWER: union
POINTS: 1
REFERENCES: 154
65. If the SQL implementation truly supports the union operation, it will remove any duplicate ____________________
automatically.
ANSWER: rows
POINTS: 1
REFERENCES: 151
Cengage Learning Testing, Powered by Cognero Page 11
Chapter 5: Multiple-Table Queries
66. If you precede a subquery by the ____________________ operator, the condition is true only if it satisfies all values
produced by the subquery.
ANSWER: ALL
POINTS: 1
REFERENCES: 154
67. If you precede a subquery by the ____________________ operator, the condition is true only if it satisfies one or
more values produced by the subquery.
ANSWER: ANY
POINTS: 1
REFERENCES: 154
68. A join that compares the tables in the FROM clause and lists only those rows that satisfy the condition in the WHERE
clause is called a(n) ____________________ join.
ANSWER: inner
POINTS: 1
REFERENCES: 157
69. Sometimes you need to list all the rows from one of the tables in a join, regardless of whether they match any rows in
the other table. This type of join is called a(n) ____________________ join.
ANSWER: outer
POINTS: 1
REFERENCES: 158
70. The ____________________ of two tables is the combination of all rows in the first table and all rows in the second
table.
ANSWER: product
Cartesian Product
POINTS: 1
REFERENCES: 159
Essay
71. What steps should you take to construct the SQL command to join (relate) tables?
ANSWER: 1. In the SELECT clause, list all columns you want to display.
2. In the FROM clause, list all tables involved in the query.
3. In the WHERE clause, list the condition that restricts the data to be retrieved to only those rows from
the two tables that match; that is, restrict it to the rows that have common values in matching columns.
POINTS: 1
REFERENCES: 134
72. What steps should you take to construct a detailed query in a step-by-step fashion?
ANSWER: 1. List in the SELECT clause all the columns that you want to display. If the name of a column appears
in more than one table, precede the column name with the table name.
2. List in the FROM clause all the tables involved in the query. Usually you include the tables that
contain the columns listed in the SELECT clause. Occasionally, however, there might be a table that
does not contain any columns used in the SELECT clause but that does contain columns used in the
WHERE clause. In this case, you must also list the table in the FROM clause.
Cengage Learning Testing, Powered by Cognero Page 12
Chapter 5: Multiple-Table Queries
3. Take one pair of related tables at a time and indicate in the WHERE clause the condition that relates
the tables. Join these conditions with the AND operator. If there are any other conditions, include them
in the WHERE clause and connect them to the other conditions with the AND operator.
POINTS: 1
REFERENCES: 149
73. There are three set operations: union, intersection, difference. Define each of these operations. Which are supported by
Oracle?
ANSWER: The union of two tables creates a temporary table containing every row that is in either the first table, the
second table, or both tables. The intersection of two tables creates a temporary table containing all rows
that are in both tables. the difference of two tables creates a temporary table containing the set of all
rows that are in the first table but that are not in the second table. Oracle supports all three set operators.
POINTS: 1
REFERENCES: 150/154
74. Why do you use the ANY and ALL operators? What is the difference between the two operators?
ANSWER: You can use the ALL and ANY operators with subqueries to produce a single column of numbers. If you
precede the subquery by the ALL operator, the condition is true only if it satisfies all values produced by
the subquery. If you precede the subquery by the ANY operator, the condition is true only if it satisfies
any value (one or more) produced by the subquery.
POINTS: 1
REFERENCES: 154