select f.name country, c.population urban_pop, f.population total_pop, (c.population/CAST(f.population AS FLOAT)) urban_pct from facts f inner join cities c on f.id = c.facts_id group by country having urban_pct > 0.5 order by 4 asc;
What I expected to happen:
The error upon submitting says “has fewer rows than expected”. I found out that my code eliminates the countries from facts table with more than one cities in cities table.
I did this without using subquery. Can anyone please explain why I am getting only those rows where there is only single city for that particular country?
What actually happened:
The error upon submitting says "has fewer rows than expected"