Difference between revisions of "SUM and COUNT Quiz"
From SQLZOO
| Line 32: | Line 32: | ||
- SELECT AVG(population) FROM bbc WHERE name LIKE (Poland, Germany, Denmark) | - SELECT AVG(population) FROM bbc WHERE name LIKE (Poland, Germany, Denmark) | ||
- SELECT population FROM bbc WHERE name IN ('Poland', 'Germany', 'Denmark') | - SELECT population FROM bbc WHERE name IN ('Poland', 'Germany', 'Denmark') | ||
| + | |||
| + | {Select the statement that shows the medium population density of each region | ||
| + | |type="()"} | ||
| + | - SELECT region, AVG(population/area) AS density FROM bbc | ||
| + | - SELECT region, COUNT(population)/COUNT(area) AS density FROM bbc GROUP BY region | ||
| + | - SELECT region, SUM(population)/COUNT(area) AS density FROM bbc GROUP BY region | ||
| + | - SELECT region, SUM(population)/SUM(area) AS density FROM bbc HAVING region | ||
| + | + SELECT region, SUM(population)/SUM(area) AS density FROM bbc GROUP BY region | ||
{Select the statement that shows the name and population density of the country with the largest population | {Select the statement that shows the name and population density of the country with the largest population | ||
Revision as of 11:47, 18 July 2012
BBC QUIZ