Test: Quiz: Group Functions
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
1. The following statement will work even though it uses the same column with different GROUP functions:
SELECT AVG(salary), MAX(salary), MIN(salary), SUM(salary)
FROM employees;
True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
2. Given the following data in the employees table (employee_id, salary, commission_pct)
DATA: (143, 2600, null
144, 2500, null
149, 10500, .2
174, 11000, .3
176, 8600, .2
178, 7000, .15)
What is the result of the following statement:
SELECT SUM(commission_pct), COUNT(commission_pct)
FROM employees
WHERE employee_id IN( 143,144,149,174,176,178)
Mark for Review
(1) Points
SUM = .85 and COUNT = 6
SUM = 1.85 and COUNT = 6
SUM = .85 and COUNT = 4 (*)
SUM = 1.85 and COUNT = 4
Correct Correct
3. Given the following data in the employees table (employee_id, salary, commission_pct)
DATA: (143, 2600, null
144, 2500, null
149, 10500, .2
174, 11000, .3
176, 8600, .2
178, 7000, .15)
What is the result of the following statement:
SELECT AVG(commission_pct)
FROM employees
WHERE employee_id IN( 143,144,149,174,176,178)
Mark for Review
(1) Points
1.2125
This statement is invalid
0.2125 (*)
0.0425
Correct Correct
4. What would the following SQL statement return?
SELECT MAX(hire_date)
FROM employees;
Mark for Review
(1) Points
The hire date of the longest serving employee
The hire date of the newest employee (*)
The hire dates of all employees in ascending order
The hire dates of all employees
Correct Correct
5. What two group functions can be used with any datatype? Mark for Review
(1) Points
STDDEV, VARIANCE
SUM, AVG
COUNT, SUM
MIN, MAX (*)
Correct Correct
6. You can use GROUP functions in all clauses of a SELECT statement. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
Page 1 of 1 Summary
( Vrei sa traduci ceva?Want to translate something? http://translate.google.ro/# )
Niciun comentariu:
Trimiteți un comentariu