SELECT dept_name , ID , avg ( salary ) FROM instructor GROUP BY dept_name; This statement IS erroneous because
Subject: Database Systems
Topic: SQL & Query Languages
Options:
- Option A: Avg(salary) should not be selected
- Option B: Dept_id should not be used in group by clause
- Option C: Misplaced group by clause
- Option D: Group by clause is not valid in this query
Correct Answer:
Option B: Dept_id should not be used in group by clause
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.