[code] Select dept_name, ID, avg (salary) from instructor group by dept_name; This statement is erroneous because [/code]

Code:
Select dept_name, ID, avg (salary)
from instructor
group by dept_name;
This statement is erroneous because
A. Avg(salary) should not be selected
B. Dept_id should not be used in group by clause
C. Misplaced group by clause
D. Group by clause is not valid in this query
 
Answer: b
Explanation: Any attribute that is not present in the group by clause must appear only inside an aggregate function if it appears in the select clause, otherwise the query is treated as erroneous.
 

Tìm kiếm

Back
Top