I use below sql query and could get the correct result, while the error message pops out.

SELECT country,
       s.urban_pop urban_pop,
       f.population total_pop,
       ROUND(CAST(s.urban_pop AS FLOAT) / f.population, 6) urban_pct 
    FROM facts f
    INNER JOIN (SELECT facts_id,
                       SUM(population) urban_pop
                       FROM cities
                       GROUP BY facts_id
                ) s ON s.facts_id =
    WHERE urban_pct > 0.5
    ORDER BY urban_pct

May I know what’s wrong?

Hi @xuyangchen8635. It looks like the only reason your code is not being accepted by the system is because of a rounding error. The autograder is expecting full precision but your code is rounding off values to 6 decimal places. If you remove the rounding, your answer will be accepted as the correct solution.

1 Like

Hi, the response did help. but does this also seek adjustment/correction to instruction 1 which reads
Write a query that generates output **as shown above.**

where the referred sample output was depicting the precision with 6 decimal places for urban_pct


Thank you for your time.

Hi @talk2_santosh and welcome to the community!

That’s a very good observation! However, in the Learn section of this screen, right above the table that shows the expected output, it says:

For expected results, we rounded to six decimal places; however, when running your query, don’t worry about rounding the urban_pct column.

This explains why using ROUND causes the code to not be accepted by the system and why the table looks different than the expected correct answer.