Multiple choice technology databases

Consider the following SELECT statement: SELECT dept_no "Departments", MAX(salary) "Max Salaries" FROM employee WHERE dept_no IN(200, 300, 400) GROUP BY Departments HAVING MAX(salary) > 60000; Due to which clause does this statement fail?

  1. Group By

  2. Where

  3. Select

  4. Having

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In standard SQL, GROUP BY cannot reference column aliases defined in the SELECT clause. The statement uses alias 'Departments' in GROUP BY, which is invalid in most databases (Oracle, SQL Server). GROUP BY must use the original column name 'dept_no', not the alias.