wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AIT 524 SQL Chapter 11

Total questions: 109

Worksheet time: 45mins

Name
Class
Date
1.
Group functions return a group of results per row processed.​
a)
true
b)
false
2.
Group functions return one result per group of rows processed.
a)
true
b)
false
3.
AVG, COUNT, and STDDEV are all considered group functions.​
a)
true
b)
false
4.
Group functions are also known as aggregate functions.​
a)
true
b)
false
5.
The only group function that includes NULL values by default is the MIN function.​
a)
true
b)
false
6.
The SUM function is used to calculate the total amount stored in a numeric field for a group of records.​
a)
true
b)
false
7.
By default, the SUM function assumes the ALL keyword and the result will include multiple occurrences of numeric values.​
a)
true
b)
false
8.
The optional UNIQUE keyword instructs Oracle 12c to include only unique numeric values in its calculation.​
a)
true
b)
false
9.
By default, the AVG function will include NULL values when calculating the average of the numeric values in a specified column.​
a)
true
b)
false
10.
The COUNT function can be used to count NULL, as well as, non-NULL values.​
a)
true
b)
false
11.
The COUNT(*) function is only used to count the number of records containing NULL values.​
a)
true
b)
false
12.
The COUNT function can only be used for numeric columns.​
a)
true
b)
false
13.
The MAX function can only be used with numeric or date columns.​
a)
true
b)
false
14.
The MAX function can be used with character data.​
a)
true
b)
false
15.
The DISTINCT keyword cannot be used with the MAX function.​
a)
true
b)
false
16.
The MIN function is used to determine the smallest value in a specified column.​
a)
true
b)
false
17.
The MIN function can be used with numeric, date, and character columns.​
a)
true
b)
false
18.
The GROUP BY clause is used to group data.​
a)
true
b)
false
19.
The GROUP BY clause can only be used when a SELECT statement includes a group function.​
a)
true
b)
false
20.
If a group function is used in the WHERE clause, then any individual columns listed in the SELECT clause must also be listed in the GROUP BY clause.​
a)
true
b)
false
21.
Columns used to group data in the GROUP BY clause must also be listed in the SELECT clause.​
a)
true
b)
false
22.
Column aliases can be used in the GROUP BY clause.​
a)
true
b)
false
23.
A SELECT statement cannot include both a GROUP BY and an ORDER BY clause.​
a)
true
b)
false
24.
The HAVING clause is used to restrict the groups returned by a query.​
a)
true
b)
false
25.
​If both nonaggregated and aggregated columns are used in the SELECT clause, the GROUP BY clause must contain the nonaggregated columns.
a)
true
b)
false
26.
The WHERE clause specifies which groups will be displayed in the results.​
a)
true
b)
false
27.
When the SELECT statement includes both WHERE and GROUP BY clauses, the GROUP BY clause is always evaluated first.​
a)
true
b)
false
28.
Group functions can only be nested to a depth of two.​
a)
true
b)
false
29.
The STDVAR function is used to determine the standard deviation of numeric data.​
a)
true
b)
false
30.
The VARIANCE function is used to determine the variance in a group of numeric data.​
a)
true
b)
false
31.
Pattern matching features available in a SELECT are targeted to analyze patterns or trends of a specific column of data across many rows.​
a)
true
b)
false
32.
A grouping sets expression can perform multiple Group BY clauses in a single query.​
a)
true
b)
false
33.
Single-row functions return one result per group of rows processed.
a)
true
b)
false
34.
SUM, AVG, and COUNT are all considered group functions.
a)
true
b)
false
35.
The only group function that includes NULL values is the NVL function.
a)
true
b)
false
36.
The TOTAL function is used to calculate the total value stored in a numeric field for a group of records.
a)
true
b)
false
37.
The COUNT function is used to total the values stored in numeric columns.
a)
true
b)
false
38.
The optional DISTINCT keyword instructs Oracle12c to include only unique numeric values in the calculation.
a)
true
b)
false
39.
The AVG function only includes non-NULL values in its calculations.
a)
true
b)
false
40.
The COUNT(*) function can be used to count the number of rows containing NULL and non-NULL values.
a)
true
b)
false
41.
By default, the COUNT function uses the DISTINCT keyword when counting the values contained in a column.
a)
true
b)
false
42.
The MAX functions returns the smallest value stored in the specified column.
a)
true
b)
false
43.
​The MIN function can be used with the DISTINCT or ALL keywords.
a)
true
b)
false
44.
The ORDER BY clause is used to group data.
a)
true
b)
false
45.
If a group function is used in the SELECT clause, then any individual columns listed in the SELECT clause must also be listed in the ORDER BY clause.
a)
true
b)
false
46.
Columns used to group data in the GROUP BY clause do not have to be listed in the SELECT clause.
a)
true
b)
false
47.
Results returned from a SELECT statement that include a GROUP BY clause will present the results in descending order of the column(s) listed in the GROUP BY clause.
a)
true
b)
false
48.
The GROUP BY clause is used to restrict the groups returned by a query.
a)
true
b)
false
49.
The WHERE clause can contain group functions.
a)
true
b)
false
50.
The HAVING clause specifies which groups will be displayed in the results, while the WHERE clause restricts the records that are retrieved from the table for processing.
a)
true
b)
false
51.
The HAVING clause serves as the WHERE clause for aggregated data.
a)
true
b)
false
52.
The WHERE clause filters the data before grouping, while the HAVING clause filters the groups after grouping is performed.
a)
true
b)
false
53.
When a SELECT statement includes WHERE, HAVING, and GROUP BY clauses, the GROUP BY clause is always evaluated first.
a)
true
b)
false
54.
When group functions are nested, the inner function is always resolved first.
a)
true
b)
false
55.
Group functions can be nested inside single-row functions.
a)
true
b)
false
56.
The STDDEV function calculates the standard deviation for the data contained in a specified field.
a)
true
b)
false
57.
The VAR function is used to determine the variance contained within a set of data.
a)
true
b)
false
58.
Which of the following is not considered a group function?​
a)
TRUNC
b)
MIN
c)
COUNT
d)
SUM
59.
Functions that return one result per group of rows are called ____ functions.​
a)
group
b)
multiple-row
c)
aggregate
d)
all apply
60.
The default keyword for group functions is ____.​
a)
ALL
b)
DISTINCT
c)
INCLUDENULLS
d)
NONULLS
61.
The SUM function can only be used with ____ data.​
a)
numeric
b)
character
c)
date
d)
alphanumeric
62.
The ____ function is used to calculate the total amount stored in a numeric field.​
a)
TOTAL
b)
SUM
c)
AVERAGE
d)
ADD
63.
If the DISTINCT keyword is not included in the SUM function, the ____ keyword will be assumed.​
a)
UNIQUE
b)
ALL
c)
RANDOM
d)
none apply
64.
The ____ function calculates the average of the numeric values in a specified column.​
a)
AVG
b)
AVERAGE
c)
MEAN
d)
AG
65.
The ____ function can be used to determine the number of rows containing a specified value.​
a)
TOTAL
b)
SUM
c)
COUNT
d)
ADD
66.
The ____ function can be used to determine the number of rows containing a specified value.​
a)
ALL
b)
UNIQUE
c)
GROUP
d)
none apply
67.
The AVG function can be used with ____ values.​
a)
numeric
b)
character
c)
date
d)
all apply
68.
Which of the following cannot be used with date columns?​
a)
MIN
b)
MAX
c)
AVG
d)
all apply
69.
The ____ function can be used to include NULL values in a calculation.​
a)
AVG
b)
SUM
c)
NULL
d)
NVL
70.
The ____ function can be used to determine the number of rows meeting a specific condition.​
a)
ADD
b)
SUM
c)
COUNT
d)
TOTAL<br />
71.
Which of the following is a correct statement?​
a)
​An asterisk can be used as the argument for the COUNT function to include NULL values in the results.
b)
​The NULL keyword can be included in the argument of the COUNT function to include NULL values in the results.
c)
​The ALL keyword can be included in the argument of the COUNT function to include NULL values in the results.
d)
​The INCLUDE NULLS keywords can be included in the argument for the COUNT function to include NULL values in the results.
72.
The ____ function can be used to determine the largest value stored in a specified column.​
a)
MAXIMUM
b)
MAX
c)
LARGE
d)
LARGEST
73.
The MAX function can be used with which type of columns?​
a)
numeric
b)
date
c)
character
d)
all apply
74.
The ____ function returns the smallest value in a specified column.​
a)
LOW
b)
LOWEST
c)
MIN
d)
MINIMUM
75.
The MIN function can be used with ____ columns.​
a)
numeric
b)
character
c)
date
d)
all apply
76.
The ____ clause is used to indicate that groups should be created.​
a)
ORDER BY
b)
GROUP BY
c)
AGGREGATED
d)
GROUPING
77.
Which of the following is a valid statement?​
a)
​The ORDER BY clause cannot be used in a SELECT statement containing a GROUP BY clause.
b)
​Data returned from a GROUP BY clause will automatically be sorted in descending order.
c)
​Column aliases cannot be used in a GROUP BY clause.
d)
​Columns referenced in the GROUP BY clause must also be contained in the SELECT clause.
78.
If a group function is used in the SELECT clause, any ____ listed in the SELECT clause must also be listed in the GROUP BY clause.​
a)
aggregate function
b)
single-row function
c)
individual column
d)
all apply
79.
The ____ clause is used to restrict the groups returned by a query.​
a)
FROM
b)
WHERE
c)
HAVING
d)
GROUP BY
80.
Which of the following lines of the SQL statement contains an error?<br /> 1 SELECT title, MAX(retail)<br /> 2 FROM books<br /> 3 WHERE retail > 30<br /> 4 AND pubid = 1<br /> 5 GROUP BY retail
a)
line 2
b)
line 3
c)
line 4
d)
line 5
81.
A(n) ____ clause cannot include a group function.​
a)
a. WHERE
b)
b. HAVING
c)
c. SELECT
d)
both a and c
82.
If a SELECT statement contains HAVING, GROUP BY, and WHERE clauses, the ____ clause will be processed first.​
a)
HAVING
b)
GROUP BY
c)
WHERE
d)
ORDER BY
83.
If a SELECT statement contains HAVING, GROUP BY, and WHERE clauses, the ____ clause will be processed last.​
a)
HAVING
b)
GROUP BY
c)
WHERE
d)
SELECT
84.
Which of the following indicates the processing order for the indicated clauses?​
a)
WHERE, HAVING, GROUP BY
b)
GROUP BY, HAVING, WHERE
c)
WHERE, GROUP BY, HAVING
d)
HAVING, WHERE, GROUP BY
85.
If the output is to be restricted based upon a group function, a(n) ____ clause must be included in the SQL statement.​
a)
GROUP BY
b)
WHERE
c)
HAVING
d)
ORDER BY
86.

Which of the following is a valid SQL statement?​

a)

SELECT SUM(quantity*retail) "Total Sales"

FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN WHERE orderdate = '02-APR-03';

b)

SELECT SUM(quantity*retail) "Total Sales"

FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03';

c)

SELECT customer#, SUM(quantity*retail) "Total Sales"

FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03';

d)

SELECT customer#, SUM(quantity*retail) "Total Sales"

FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03' GROUP BY customer#;

87.
Group functions can be nested to a depth of ____.​
a)
2
b)
25
c)
30
d)
255
88.
A group function can be nested inside a(n)____.​
a)
a. group function
b)
b. single-row function
c)
c. order function
d)
both a and b
89.
Which of the following is a valid statement?​
a)
​A single-row function can be nested inside a group function.
b)
​Group functions can be nested inside other group functions.
c)
​Group functions can be nested inside single-row functions.
d)
all apply
90.
The ____ function calculates the standard deviation for a specific set of data.​
a)
STDDEVIATION
b)
STD(haha)
c)
STDDEV
d)
STANDARDDEV
91.
If the DISTINCT keyword is not included in the STDDEV function, the ____ keyword will be assumed.​
a)
UNIQUE
b)
ALL
c)
NONULLS
d)
none apply
92.
The STDDEV function can be used with ____ columns.​
a)
numeric
b)
character
c)
date
d)
all apply
93.
The ____ function is based upon the concept of a normal distribution.​
a)
MIN
b)
MAX
c)
SUM
d)
STDDEV
94.
The ____ function is used to determine how widely data are spread out within a group.​
a)
STDDEVIATION
b)
STANDARDDEV
c)
VARIANCE
d)
VAR
95.
If the DISTINCT keyword is not included in the VARIANCE function, the ____ keyword will be assumed.​
a)
UNIQUE
b)
ALL
c)
NULLS ONLY
d)
NONULLS
96.
The VARIANCE function can be used with ____ columns.​
a)
alphanumeric
b)
numeric
c)
date
d)
none apply
97.

Based upon the contents of the BOOKS tables, which of the following SQL statements will return the number of different publishers represented in the table?​

a)

SELECT COUNT(DISTINCT pubid) FROM books;

b)

SELECT DISTINCT COUNT(pubid) FROM books;

c)

SELECT DISTINCT (COUNT(pubid)) FROM books;

d)

SELECT (DISTINCT COUNT(pubid)) FROM books;

98.

Based on the contents of the BOOKS table, which of the following is a valid SQL statement?​

a)

SELECT pubid, AVERAGE(retail-cost) "Average Profit"

FROM books;

b)

SELECT pubid, AVERAGE(retail-cost) "Average Profit"

FROM books

GROUP BY pubid;​

c)

SELECT pubid, AVG(retail-cost) "Average Profit"

FROM books

GROUP BY pubid;

d)

SELECT pubid, AVG(retail-cost) "Average Profit"

FROM books

HAVING retail-cost > 25;

99.

Based on the contents of the BOOKS table, which of the following SQL statements will return the total profit generated by books provided by publisher 4?​

a)

SELECT TOTAL(retail-cost) FROM books

WHERE pubid = 4;

b)

SELECT TOTAL(retail-cost) FROM books

GROUP BY pubid;

c)

SELECT SUM(retail-cost) FROM books

WHERE pubid = 4;

d)

SELECT SUM(retail-cost) FROM books

GROUP BY pubid = 4;​

100.

Based upon the contents of the BOOKS table, which of the following will determine the number of books provided by publisher 3?​

a)

SELECT SUM(isbn)

FROM books

WHERE pubid = 3;

b)

SELECT TOTAL(*)

FROM books

WHERE pubid = 3;

c)

SELECT COUNT(pubid)

FROM books

WHERE pubid = 3;

d)

none apply

101.

Based upon the contents of the BOOKS table, which of the following will display the retail price of the most expensive book provided by publisher 3?​

a)

SELECT MAX(retail)

FROM books

GROUP BY pubid;

b)

SELECT MAXIMUM(retail)

FROM books

WHERE pubid = 3;​

c)

SELECT MAX(retail)

FROM books

WHERE pubid = 3;

d)

SELECT MAXIMUM(retail)

FROM books

HAVING pubid = 3;

102.

Based on the contents of the BOOKS table, which of the following will display the date of the book with the earliest publication date?​

a)

SELECT MIN(pubdate)

FROM books;

b)

SELECT title

FROM books

WHERE pubdate = MIN(pubdate);​

c)

SELECT title

FROM books

WHERE pubdate = MINIMUM(pubdate);

d)

SELECT MINIMUM(pubdate)

FROM books;

103.

​Which of the following can be used with character data?

a)

MIN

b)

MAX

c)

COUNT

d)

all apply

104.

​Which of the following can be used with date columns?

a)

MIN

b)

MAX

c)

COUNT

d)

all apply

105.

​Based on the contents of the ORDERS table, which of the following SQL statements will display the number of orders that have not been shipped?

a)

SELECT order#, COUNT(shipdate)

FROM orders

WHERE shipdate IS NULL;

b)

SELECT order#, COUNT(shipdate)

FROM orders

WHERE shipdate IS NULL

GROUP BY order#;

c)

SELECT COUNT(shipdate)

FROM orders

WHERE shipdate IS NULL;

d)

SELECT COUNT(*)

FROM orders

WHERE shipdate IS NULL;

106.

​Based on the contents of the ORDERS table, which of the following SELECT statements will determine the number of orders placed by each customer?

a)

SELECT COUNT(DISTINCT(customer#))

FROM orders;

b)

SELECT COUNT(*)

FROM orders;

c)

SELECT customer#, COUNT(customer#)

FROM orders

GROUP BY customer#;

d)

none apply

107.

​Based upon the contents of the ORDERS table, which of the following will display how many orders were shipped to each state?

a)

SELECT shipstate,COUNT(*)

FROM orders;

b)

SELECT shipstate,COUNT(customer#)

FROM orders;

c)

SELECT shipstate,COUNT(*)

FROM orders

HAVING COUNT(*) >0

d)

SELECT shipstate,COUNT(*)

FROM orders

GROUP BY shipstate;

108.

​Which of the following is not a GROUP BY extension?

a)

ROLLUP

b)

CUBE

c)

OLAP

d)

all apply

109.

​What clause offers many options to identify measures and patterns to analyze in a query?

a)

ANALYZE

b)

MATCH_RECOGNIZE

c)

PATTERN_MATCH

d)

MATCH_TREND