Deck 11: Group Functions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/134
Play
Full screen (f)
Deck 11: Group Functions
1
The MAX function can be used with character data.
True
2
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.
False
3
The MAX function can only be used with numeric or date columns.
False
4
The COUNT function can be used to count NULL, as well as, non-NULL values.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
5
The optional UNIQUE keyword instructs Oracle 11g to include only unique numeric values in its calculation.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
6
Group functions return a group of results per row processed.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
7
The COUNT(*) function is only used to count the number of records containing NULL values.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
8
Group functions are also known as aggregate functions.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
9
The MIN function can be used with numeric, date, and character columns.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
10
Group functions return one result per group of rows processed.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
11
The GROUP BY clause can only be used when a SELECT statement includes a group function.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
12
By default, the AVG function will include NULL values when calculating the average of the numeric values in a specified column.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
13
By default, the SUM function assumes the ALL keyword and the result will include multiple occurrences of numeric values.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
14
The COUNT function can only be used for numeric columns.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
15
The DISTINCT keyword cannot be used with the MAX function.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
16
The only group function that includes NULL values by default is the MIN function.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
17
The SUM function is used to calculate the total amount stored in a numeric field for a group of records.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
18
The MIN function is used to determine the smallest value in a specified column.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
19
The GROUP BY clause is used to group data.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
20
AVG, COUNT, and STDDEV are all considered group functions.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
21
The MAX functions returns the value stored in the specified column. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
22
functions return one result per group of rows processed. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
23
If both nonaggregated and aggregated columns are used in the SELECT clause, the GROUP BY clause must contain the nonaggregated columns.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
24
When the SELECT statement includes both WHERE and GROUP BY clauses, the GROUP BY clause is always evaluated first.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
25
The VARIANCE function is used to determine the variance in a group of numeric data.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
26
By default, the COUNT function uses the keyword when counting the values contained in a column. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
27
Group functions can only be nested to a depth of two.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
28
The WHERE clause specifies which groups will be displayed in the results.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
29
Columns used to group data in the GROUP BY clause must also be listed in the SELECT clause.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
30
The optional keyword instructs Oracle11g to include only unique numeric values in the calculation. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
31
The function is used to calculate the total value stored in a numeric field for a group of records. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
32
The only group function that includes NULL values is the function. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
33
SUM, AVG, and COUNT are all considered functions. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
34
The function only includes non-NULL values in its calculations. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
35
Column aliases can be used in the GROUP BY clause.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
36
The STDVAR function is used to determine the standard deviation of numeric data.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
37
The function can be used to count the number of rows containing NULL and non-NULL values. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
38
The function is used to total the values stored in numeric columns. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
39
The HAVING clause is used to restrict the groups returned by a query.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
40
A SELECT statement cannot include both a GROUP BY and an ORDER BY clause.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
41
The HAVING clause serves as the clause for aggregated data. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
42
The function is used to determine the variance contained within a set of data. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
43
The WHERE clause contain group functions. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
44
Which of the following is not considered a group function?
A) TRUNC
B) MIN
C) COUNT
D) SUM
A) TRUNC
B) MIN
C) COUNT
D) SUM
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
45
The function calculates the standard deviation for the data contained in a specified field. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
46
The 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. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
47
The default keyword for group functions is ____.
A) ALL
B) DISTINCT
C) INCLUDENULLS
D) NONULLS
A) ALL
B) DISTINCT
C) INCLUDENULLS
D) NONULLS
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
48
The WHERE clause filters the data before grouping, while the HAVING clause filters the groups grouping is performed. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
49
Functions that return one result per group of rows are called ____ functions.
A) group
B) multiple-row
C) aggregate
D) all of the above
A) group
B) multiple-row
C) aggregate
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
50
When group functions are nested, the function is always resolved first. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
51
Group functions can be nested inside functions. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
52
Columns used to group data in the clause do not have to be listed in the SELECT clause. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
53
The clause is used to restrict the groups returned by a query. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
54
The clause is used to group data. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
55
The function can be used with the DISTINCT or ALL keywords. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
56
The SUM function can only be used with ____ data.
A) numeric
B) character
C) date
D) alphanumeric
A) numeric
B) character
C) date
D) alphanumeric
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
57
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 clause. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
58
Results returned from a SELECT statement that include a GROUP BY clause will present the results in order of the column(s) listed in the GROUP BY clause. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
59
The ____ function is used to calculate the total amount stored in a numeric field.
A) TOTAL
B) SUM
C) AVERAGE
D) ADD
A) TOTAL
B) SUM
C) AVERAGE
D) ADD
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
60
When a SELECT statement includes WHERE, HAVING, and GROUP BY clauses, the clause is always evaluated first. _________________________
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
61
The ____ function calculates the average of the numeric values in a specified column.
A) AVG
B) AVERAGE
C) MEAN
D) AG
A) AVG
B) AVERAGE
C) MEAN
D) AG
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
62
If the DISTINCT keyword is not included in the SUM function, the ____ keyword will be assumed.
A) UNIQUE
B) ALL
C) RANDOM
D) none of the above
A) UNIQUE
B) ALL
C) RANDOM
D) none of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
63
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.
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.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
64
If the DISTINCT keyword is not included in the AVG function, the ____ keyword will be assumed.
A) ALL
B) UNIQUE
C) GROUP
D) none of the above
A) ALL
B) UNIQUE
C) GROUP
D) none of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
65
Which of the following lines of the SQL statement contains an error? 1 SELECT title, MAX(retail)
2 FROM books
3 WHERE retail > 30
4 AND pubid = 1
5 GROUP BY retail;
A) Line 2
B) Line 3
C) Line 4
D) Line 5
2 FROM books
3 WHERE retail > 30
4 AND pubid = 1
5 GROUP BY retail;
A) Line 2
B) Line 3
C) Line 4
D) Line 5
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
66
A(n) ____ clause cannot include a group function.
A) WHERE
B) HAVING
C) SELECT
D) both a and c
A) WHERE
B) HAVING
C) SELECT
D) both a and c
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
67
The ____ function can be used to determine the number of rows containing a specified value.
A) TOTAL
B) SUM
C) COUNT
D) ADD
A) TOTAL
B) SUM
C) COUNT
D) ADD
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
68
The ____ clause is used to restrict the groups returned by a query.
A) FROM
B) WHERE
C) HAVING
D) GROUP BY
A) FROM
B) WHERE
C) HAVING
D) GROUP BY
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
69
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.
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.
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
70
The ____ function can be used to determine the largest value stored in a specified column.
A) MAXIMUM
B) MAX
C) LARGE
D) LARGEST
A) MAXIMUM
B) MAX
C) LARGE
D) LARGEST
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
71
Which of the following cannot be used with date columns?
A) MIN
B) MAX
C) AVG
D) all of the above
A) MIN
B) MAX
C) AVG
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
72
The ____ function can be used to determine the number of rows meeting a specific condition.
A) ADD
B) SUM
C) COUNT
D) TOTAL
A) ADD
B) SUM
C) COUNT
D) TOTAL
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
73
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 of the above
A) aggregate function
B) single-row function
C) individual column
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
74
The ____ clause is used to indicate that groups should be created.
A) ORDER BY
B) GROUP BY
C) AGGREGATED
D) GROUPING
A) ORDER BY
B) GROUP BY
C) AGGREGATED
D) GROUPING
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
75
The ____ function can be used to include NULL values in a calculation.
A) AVG
B) SUM
C) NULL
D) NVL
A) AVG
B) SUM
C) NULL
D) NVL
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
76
The MIN function can be used with ____ columns.
A) numeric
B) character
C) date
D) all of the above
A) numeric
B) character
C) date
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
77
The MAX function can be used with which type of columns?
A) numeric
B) date
C) character
D) all of the above
A) numeric
B) date
C) character
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
78
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
A) HAVING
B) GROUP BY
C) WHERE
D) ORDER BY
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
79
The AVG function can be used with ____ values.
A) numeric
B) character
C) date
D) all of the above
A) numeric
B) character
C) date
D) all of the above
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck
80
The ____ function returns the smallest value in a specified column.
A) LOW
B) LOWEST
C) MIN
D) MINIMUM
A) LOW
B) LOWEST
C) MIN
D) MINIMUM
Unlock Deck
Unlock for access to all 134 flashcards in this deck.
Unlock Deck
k this deck