SQL Practice Logo

SQLPractice Online

COUNT, SUM, AVG, MIN, MAX: Mistakes

Module: Aggregate Functions & Grouping

SELECT department, COUNT(*) FROM employees;

SELECT department, COUNT(*) FROM employees GROUP BY department;

Cannot mix non-aggregate columns with aggregates without GROUP BY.

Every column in SELECT must either be in GROUP BY or inside an aggregate function

High

Column "department" must appear in GROUP BY clause