← Quiz: GROUP BY and HAVING: all 10 questions
Quiz: GROUP BY and HAVING · Question 9 of 10
Why does SELECT salary 12 AS yearly FROM employees WHERE yearly 600000 fail in standard SQL?
Why does SELECT salary * 12 AS yearly FROM employees WHERE yearly > 600000 fail in standard SQL?
- A.WHERE runs before SELECT, so the alias
yearlydoes not exist yet - B.Aliases are never allowed in SQL
- C.Multiplication is not allowed in SELECT
- D.WHERE must come after ORDER BY
Answer & explanation
Correct answer: WHERE runs before SELECT, so the alias yearly does not exist yet
Repeat the expression in WHERE, or use the alias only in ORDER BY.
Can you get the rest right without peeking?
Take the timed Quiz: GROUP BY and HAVING quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →