🎴 Flashcard Mode
Oracle Database and SQL Fundamentals
Card1 / 20
Mastered0
Review0
QuestionClick to flip
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?
AnswerClick to flip back
A
Group By
💡 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.