Guided Project:Analyzing CIA Facebook Data Using SQLite and R

The code on the notebook on Github for solution
q3=“SELECT * FROM facts WHERE (population ==MAX(population))”
result3=dbGetQuery(conn,q3)
Brings up an error: misuse of aggregate function MAX().

I got it right by subquerying WHERE population=(SELECT MAX(population) FROM facts)
OR using the direct value for MAX(population)without subquery i.e
WHERE (population==7256490011)

Probably this small tutorial may help to understand that this is sort of expected behavior here.

1 Like