Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 1
True / False
1. A query is a question represented in a way that the DBMS can understand.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
97
2. SQL requires that you follow special formatting rules.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
3. In a SELECT statement, the FROM clause and the WHERE clause (when used) must appear on separate lines.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
4. All SELECT statements require a WHERE clause.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
5. After the word FROM in a SELECT statement, you list any conditions (restrictions) that apply to the data you want to
retrieve.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
6. Instead of including every column in the SELECT clause, you can use an ampersand (&) to indicate that you want to
include all columns.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
Cengage Learning Testing, Powered by Cognero
Page 2
7. A simple condition has the form: column name, comparison operator, and then either another column name or a value.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
101
8. The WHERE clause is used to retrieve rows that satisfy some condition.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
100
9. Preceding a condition by the NOT operator reverses the truth of the original condition.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
102
10. When the OR operator connects simple conditions, the compound condition will be true whenever any one of the
simple conditions is true.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
102
11. When you connect two or more simple conditions with the AND operator, each condition must be listed on a separate
line.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
12. The BETWEEN operator is an essential feature of SQL.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
13. An arithmetic column is a column that does not exist in the database but can be computed using data in existing
columns.
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 3
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
14. The only arithmetic operators that can be used in SELECT statements are + for addition and – for subtraction.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
15. You cannot assign names to computed columns.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
16. You can use computed columns in comparisons.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
108
17. When you query a database, there is a defined order in which the results are displayed.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
18. To specify that query results be listed in a specific order, use the SORT BY clause.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
19. To sort records in descending order, follow the name of the sort key with the REVERSE operator.
a.
True
b.
False
ANSWER:
Cengage Learning Testing, Powered by Cognero
Page 5
26. It is possible to place one query inside another.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
118
27. In a nested query, the outer query is evaluated first.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
28. The GROUP BY clause sorts the data in a particular order.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
29. The WHERE clause applies to both rows and groups.
a.
True
b.
False
ANSWER:
POINTS:
REFERENCES:
30. The HAVING clause is used to restrict groups that are included in a query result.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
122
31. It is possible to use both a WHERE clause and a HAVING clause in a SELECT statement.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
124
32. Sometimes a condition involves a column that can accept null values.
a.
True
b.
False
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 6
ANSWER:
True
POINTS:
1
REFERENCES:
125
Multiple Choice
33. In SQL, you use the ____ command to query a database.
a.
WHERE
b.
SELECT
c.
FROM
d.
SET
ANSWER:
b
POINTS:
1
REFERENCES:
97
34. The basic form of the SQL SELECT command is ____.
a.
FROM-SELECT-WHERE
b.
SELECT-FROM-WHERE
c.
FROM-WHERE-SELECT
d.
WHERE-SELECT-FROM
ANSWER:
b
POINTS:
1
REFERENCES:
97
35. In the SELECT clause, you can use the ____ symbol to indicate that you want to include all columns.
a.
\
b.
/
c.
*
d.
?
ANSWER:
c
POINTS:
1
REFERENCES:
99
36. You form compound conditions by connecting two or more simple conditions using the ____ operator.
a.
AND
b.
OR
c.
NOT
d.
All of the above
ANSWER:
d
POINTS:
1
REFERENCES:
102
37. Preceding a condition by the ____ operator reverses the truth of the original condition.
a.
REVERSE
b.
NOT
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 7
c.
NULL
d.
OR
ANSWER:
b
POINTS:
1
REFERENCES:
102
38. The ____ operator specifies a range of values in a condition.
a.
LIKE
b.
BETWEEN
c.
DISTINCT
d.
GROUP
ANSWER:
b
POINTS:
1
REFERENCES:
102
39. The ____ operator is inclusive, meaning that a value equal to either end would be selected.
a.
AND
b.
BETWEEN
c.
OR
d.
NOT
ANSWER:
b
POINTS:
1
REFERENCES:
105
40. Which of the following operators can be used for a column computation?
a.
+
b.
^
c.
**
d.
All of the above
ANSWER:
a
POINTS:
1
REFERENCES:
106
41. In SQL for Oracle and for SQL Server, the ____ symbol is used as a wildcard to represent any collection of characters.
a.
*
b.
%
c.
?
d.
!
ANSWER:
b
POINTS:
1
REFERENCES:
109
42. The ____ operator uses one or more wildcard characters to test for a pattern match.
a.
PATTERN
b.
LIKE
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 8
c.
MATCH
d.
SIMILAR
ANSWER:
b
POINTS:
1
REFERENCES:
109
43. The ____ wildcard symbol represents any individual character.
a.
%
b.
_
c.
/
d.
\
ANSWER:
b
POINTS:
1
REFERENCES:
109
44. You can use the ____ operator followed by a collection of values to provide a concise way of phrasing certain
conditions.
a.
LIKE
b.
CONTAIN
c.
VALUES
d.
IN
ANSWER:
d
POINTS:
1
REFERENCES:
110
45. You use the ____ clause to list data in a specific order.
a.
ORDER
b.
SET ORDER
c.
ORDER BY
d.
LIST BY
ANSWER:
c
POINTS:
1
REFERENCES:
111
46. When you need to sort data on two columns, the less important column is called the ____ sort key.
a.
double
b.
primary
c.
minor
d.
foreign
ANSWER:
c
POINTS:
1
REFERENCES:
112
47. The ____ function determines the number of rows in a table.
a.
ROW
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 9
b.
CALCULATE
c.
COUNT
d.
NUMBER
ANSWER:
c
POINTS:
1
REFERENCES:
112
48. The ____ function calculates a total of the values in a column.
a.
TOTAL
b.
CALCULATE
c.
SUM
d.
ADD
ANSWER:
c
POINTS:
1
REFERENCES:
112
49. When you use the ____ function, you can use the asterisk (*) to represent any column.
a.
SUM
b.
COUNT
c.
MAX
d.
MIN
ANSWER:
b
POINTS:
1
REFERENCES:
113
50. The ____ clause lets you group data on a particular column.
a.
GROUP
b.
GROUP BY
c.
SET GROUP
d.
GROUPING
ANSWER:
b
POINTS:
1
REFERENCES:
121
51. The ____ clause is used to restrict the groups that will be included in a query result.
a.
LIKE
b.
HAVING
c.
WHERE
d.
HAVE
ANSWER:
b
POINTS:
1
REFERENCES:
122
52. The ____ operator finds rows that do not contain a null value in the specified column.
a.
IS NULL
Chapter 4: Single-Table Queries
Cengage Learning Testing, Powered by Cognero
Page 10
b.
NOT NULL
c.
!NULL
d.
IS NOT NULL
ANSWER:
d
POINTS:
1
REFERENCES:
125
Completion
53. A(n) ____________________ is simply a question represented in a way that the DBMS can understand.
ANSWER:
query
POINTS:
1
REFERENCES:
97
54. You use the ____________________ clause to retrieve rows that satisfy some condition.
ANSWER:
AND
POINTS:
1
REFERENCES:
100
55. When the ____________________ operator connects simple conditions, all the simple conditions must be true in
order for the compound condition to be true.
ANSWER:
AND
POINTS:
1
REFERENCES:
102
56. ____________________ conditions are formed by connecting two or more simple conditions.
ANSWER:
Compound
POINTS:
1
REFERENCES:
102
57. A(n) ____________________ column is a column that does not exist in the database but can be computed using data
in the existing columns.
ANSWER:
computed
POINTS:
1
REFERENCES:
106
58. You can assign a name to a computed column by following the computation with the word ____________________
and the desired name.
ANSWER:
AS
POINTS:
1
REFERENCES:
107
59. The ____________________ operator uses one or more wildcard characters to test for a pattern match.
ANSWER:
LIKE
POINTS:
1
REFERENCES:
108
Cengage Learning Testing, Powered by Cognero
Page 11
60. A(n) ____________________ clause provides a concise way of phrasing certain conditions.
ANSWER:
IN
POINTS:
1
REFERENCES:
110
61. In SQL, you specify the order of data in query results by using the ____________________ clause.
ANSWER:
ORDER BY
POINTS:
1
REFERENCES:
110
62. The column on which data is to be sorted is called a sort ____________________.
ANSWER:
key
POINTS:
1
REFERENCES:
111
63. When you need to sort data on two columns, the more important column is called the ____________________ sort
key.
ANSWER:
major
primary
POINTS:
1
REFERENCES:
112
64. To sort records in descending order, follow the name of the sort key with the ____________________ operator.
ANSWER:
DESC
POINTS:
1
REFERENCES:
112
65. SQL has special functions, called ____________________ functions, to calculate sums, averages, counts, maximum
values, and minimum values.
ANSWER:
aggregate
POINTS:
1
REFERENCES:
112
66. When you use the ____________________ function, you must specify the column to total, and the column data type
must be numeric.
ANSWER:
SUM
POINTS:
1
REFERENCES:
113
67. When you use the MAX function, SQL ignores any ____________________ value(s) in the column and eliminates
them from the computations.
ANSWER:
null
POINTS:
1
REFERENCES:
114
68. The ____________________ operator eliminates duplicate values in the query results.
ANSWER:
DISTINCT