Difference between revisions of "SUM and COUNT Quiz"
From SQLZOO
| Line 68: | Line 68: | ||
- COUNT(), SUM() | - COUNT(), SUM() | ||
| − | {Select the result that would be obtained from the following code: | + | {Select the result that would be obtained from the following code:SELECT region, SUM(area) FROM bbc WHERE SUM(area) > 15000000 GROUP BY region |
| + | <table style='float:left'><caption>Table-A</caption><tr><td>Europe</td><td>17000000</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-B</caption><tr><td>Europe</td><td>17000000</td></tr><tr><td>Asia-Pacific</td><td>23460000</td></tr><tr><td>North America</td><td>21660000</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-C</caption><tr><td>Europe</td><td></td></tr><tr><td>Asia-Pacific</td><td></td></tr><tr><td>North America</td><td></td></tr></table> | ||
|type="()"} | |type="()"} | ||
- Table-A | - Table-A | ||
- Table-B | - Table-B | ||
| − | + | + | + Table-C |
| − | - | + | - No result due to invalid use of the GROUP BY function |
| − | - | + | - No result due to invalid use of the WHERE function |
{Select the statement that shows the average population of 'Poland', 'Germany' and 'Denmark' | {Select the statement that shows the average population of 'Poland', 'Germany' and 'Denmark' | ||
| Line 100: | Line 103: | ||
- SELECT name, population/area AS density FROM bbc WHERE population > (SELECT MAX(population) FROM bbc) | - SELECT name, population/area AS density FROM bbc WHERE population > (SELECT MAX(population) FROM bbc) | ||
| − | { | + | {Pick the result that would be obtained from the following code: |
|type="()"} | |type="()"} | ||
- Table-A | - Table-A | ||
- Table-B | - Table-B | ||
| − | + | + | + Table-C |
- Table-D | - Table-D | ||
- Table-E | - Table-E | ||
Revision as of 10:33, 7 August 2012
SUM and COUNT QUIZ
| name | region | area | population | gdp |
|---|---|---|---|---|
| Afghanistan | South Asia | 652225 | 26000000 | |
| Albania | Europe | 28728 | 3200000 | 6656000000 |
| Algeria | Middle East | 2400000 | 32900000 | 75012000000 |
| Andorra | Europe | 468 | 64000 | |
| ... | ||||