Ch. 11 Group Functions Flashcards
The MAX function can be used with which type of columns?
- numeric
- date
- character
- all of the above
-all of the above
The ____ function can be used to determine the number of rows containing a specified value.
- TOTAL
- SUM
- COUNT
- ADD
-COUNT
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;
- Line 2
- Line 3
- Line 4
- Line 5
-Line 5
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?
SELECT COUNT(DISTINCT pubid) FROM books;
SELECT DISTINCT COUNT(pubid) FROM books;
SELECT DISTINCT (COUNT(pubid)) FROM books;
SELECT (DISTINCT COUNT(pubid)) FROM books;
SELECT COUNT(DISTINCT pubid) FROM books;
The MIN function can be used with ____ columns.
- numeric
- character
- date
- all of the above
-all of the above
Based on the contents of the BOOKS table, which of the following will display the date of the book with the earliest publication date?
SELECT MIN(pubdate) FROM books;
SELECT title
FROM books
WHERE pubdate = MIN(pubdate);
SELECT title
FROM books
WHERE pubdate = MINIMUM(pubdate);
SELECT MINIMUM(pubdate) FROM books;
SELECT MIN(pubdate) FROM books;
The ____ function can be used to include NULL values in a calculation.
- AVG
- SUM
- NULL
- NVL
-NVL
Functions that return one result per group of rows are called ____ functions.
- group
- multiple-row
- aggregate
- all of the above
-all of the above
The ____ function calculates the standard deviation for a specific set of data.
- STDDEVIATION
- STD
- STDDEV
- STANDARDDEV
-STDDEV
Which of the following indicates the processing order for the indicated clauses?
- WHERE, HAVING, GROUP BY
- GROUP BY, HAVING, WHERE
- WHERE, GROUP BY, HAVING
- HAVING, WHERE, GROUP BY
-WHERE, GROUP BY, HAVING
Which of the following is a valid statement?
The ORDER BY clause cannot be used in a SELECT statement containing a GROUP BY clause.
Data returned from a GROUP BY clause will automatically be sorted in descending order.
Column aliases cannot be used in a GROUP BY clause.
Columns referenced in the GROUP BY clause must also be contained in the SELECT clause.
Column aliases cannot be used in a GROUP BY clause.
The VARIANCE function can be used with ____ columns.
- alphanumeric
- numeric
- date
- none of the above
-numeric
The ____ function is based upon the concept of a normal distribution.
- MIN
- MAX
- SUM
- STDDEV
-STDDEV
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.
- aggregate function
- single-row function
- individual column
- all of the above
-individual column
The ____ clause is used to restrict the groups returned by a query.
- FROM
- WHERE
- HAVING
- GROUP BY
-HAVING