Aggregate functions - sql

I was learning ‘Group By’ as part of SQL’s Aggregate Functions. https://www.codecademy.com/courses/learn-sql/lessons/aggregate-functions/exercises/groupby

In the code editor, I typed the following query and it didn’t fetch any results.

SELECT price, COUNT (*)
WHERE downloads > 20,000
FROM fake_apps
GROUP BY price;

Only if FROM fake_apps is shifted to the second line after the WHERE, the query is fetching some results. Why is that so? Can someone please help?

Many thanks in advance!

One thing…your WHERE clause isn’t in the correct place.

Order of a SQL query:

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
LIMIT;
1 Like