Difference between revisions of "BBC QUIZ"
From SQLZOO
| (23 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
BBC QUIZ | BBC QUIZ | ||
| + | <div class='ref_section'> | ||
| + | <table class='db_ref'> | ||
| + | <caption>bbc</caption> | ||
| + | <tr> | ||
| + | <th>name</th> | ||
| + | <th>region</th> | ||
| + | <th>area</th> | ||
| + | <th>population</th> | ||
| + | <th>gdp</th> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Afghanistan</td> | ||
| + | <td>South Asia</td> | ||
| + | <td align='right'>652225</td> | ||
| + | <td align='right'>26000000</td> | ||
| + | <td></td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Albania</td> | ||
| + | <td>Europe</td> | ||
| + | <td align='right'>28728</td> | ||
| + | <td align='right'>3200000</td> | ||
| + | <td align='right'>6656000000</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Algeria</td> | ||
| + | <td>Middle East</td> | ||
| + | <td align='right'>2400000</td> | ||
| + | <td align='right'>32900000</td> | ||
| + | <td align='right'>75012000000</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Andorra</td> | ||
| + | <td>Europe</td> | ||
| + | <td align='right'>468</td> | ||
| + | <td align='right'>64000</td> | ||
| + | <td></td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Brazil</td> | ||
| + | <td>South America</td> | ||
| + | <td align='right'>8550000</td> | ||
| + | <td align='right'>182800000</td> | ||
| + | <td>564852000000</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Colombia</td> | ||
| + | <td>South America</td> | ||
| + | <td align='right'>1140000</td> | ||
| + | <td align='right'>45600000</td> | ||
| + | <td></td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Nauru</td> | ||
| + | <td>Asia-Pacific</td> | ||
| + | <td align='right'>21</td> | ||
| + | <td align='right'>9900</td> | ||
| + | <td></td> | ||
| + | </tr> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>Uzbekistan</td> | ||
| + | <td>Central Asia</td> | ||
| + | <td align='right'>447000</td> | ||
| + | <td align='right'>26000000</td> | ||
| + | <td></td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td colspan='5'>...</td> | ||
| + | </tr> | ||
| + | </table> | ||
| + | </div> | ||
| + | |||
<quiz shuffle=none display=simple> | <quiz shuffle=none display=simple> | ||
| − | { | + | {Select the code which gives the name of countries beginning with U |
|type="()"} | |type="()"} | ||
- SELECT name FROM bbc WHERE name BEGIN with C | - SELECT name FROM bbc WHERE name BEGIN with C | ||
- SELECT name FROM bbc WHERE name LIKE '%C' | - SELECT name FROM bbc WHERE name LIKE '%C' | ||
- SELECT name FROM bbc WHERE name LIKE '%C%' | - SELECT name FROM bbc WHERE name LIKE '%C%' | ||
| − | - SELECT name FROM bbc WHERE name LIKE | + | - SELECT name FROM bbc WHERE name LIKE U |
| − | + SELECT name FROM bbc WHERE name LIKE ' | + | + SELECT name FROM bbc WHERE name LIKE 'U%' |
| − | { | + | {Select the code which shows just the population of United Kingdom? |
|type="()"} | |type="()"} | ||
- SELECT name FROM bbc WHERE name Like 'United%' | - SELECT name FROM bbc WHERE name Like 'United%' | ||
| Line 17: | Line 90: | ||
- SELECT population FROM bbc WHERE name = United Kingdom | - SELECT population FROM bbc WHERE name = United Kingdom | ||
| − | + | {Select the answer which shows the problem with this SQL code:SELECT name FROM "bbc" WHERE population > '2000000' | |
| − | { | + | |
|type="()"} | |type="()"} | ||
- Apostrophes should be used around 'bbc' instead of speech marks | - Apostrophes should be used around 'bbc' instead of speech marks | ||
| Line 24: | Line 96: | ||
+ There are speech marks surrounding "bbc" | + There are speech marks surrounding "bbc" | ||
- There are speech marks surrounding "bbc" and there is apostrophes surrounding '2000000' | - There are speech marks surrounding "bbc" and there is apostrophes surrounding '2000000' | ||
| − | - | + | - The use of a WHERE function is incorrect |
| − | { | + | {Select the result that would be obtained from the following code: SELECT name, population / 10 FROM bbc WHERE population < 10000 |
| + | <table style='float:left'><caption>Table-A</caption><tr><td>Andorra</td><td>6400</td></tr><tr><td>Nauru</td><td>990</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-B</caption><tr><td>Andorra</td><td>64000</td></tr><tr><td>Nauru</td><td>9900</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-C</caption><tr><td>Nauru</td><td>99</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-D</caption><tr><td>Nauru</td><td>990</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-E</caption><tr><td>Nauru</td><td>9900</td></tr></table> | ||
| + | |type="()"} | ||
| + | - Table-A | ||
| + | - Table-B | ||
| + | - Table-C | ||
| + | + Table-D | ||
| + | - Table-E | ||
| + | |||
| + | {Select the code which would reveal the name and population of countries in Europe, North America and South America | ||
|type="()"} | |type="()"} | ||
- SELECT name FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | - SELECT name FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | ||
| Line 34: | Line 119: | ||
- SELECT population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | - SELECT population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | ||
| − | { | + | {Select the code which would give two rows |
|type="()"} | |type="()"} | ||
| + | - SELECT name FROM bbc WHERE name = 'United Kingdom' | ||
- SELECT name FROM bbc WHERE name = 'United Kingdom' AND name = 'Algeria' | - SELECT name FROM bbc WHERE name = 'United Kingdom' AND name = 'Algeria' | ||
| − | - SELECT name FROM bbc WHERE name | + | - SELECT name FROM bbc WHERE name EITHER ('United Kingdom', 'Algeria') |
| − | + SELECT name FROM bbc WHERE name | + | + SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria') |
| − | - SELECT name FROM | + | - SELECT name FROM WHERE name IS 'Scotland' |
| − | - | + | |
| + | {Select the result that would be obtained from this code: | ||
| + | <source lang='SQL'>SELECT name FROM bbc WHERE region = 'South America' AND population > 40000000</source> | ||
| + | <table style='float:left'><caption>Table-A</caption><tr><td>Afghanistan</td></tr><tr><td>Brazil</td></tr><tr><td>Colombia</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-B</caption><tr><td>Brazil</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-C</caption><tr><td>Brazil</td></tr><tr><td>Colombia</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-D</caption><tr><td>Brazil</td><td>South America</td></tr><tr><td>Colombia</td><td>South America</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-E</caption><tr><td>Brazil</td><td>182800000</td></tr><tr><td>Colombia</td><td>45600000</td></tr></table> | ||
| + | |type="()"} | ||
| + | - Table-A | ||
| + | - Table-B | ||
| + | + Table-C | ||
| + | - Table-D | ||
| + | - Table-E | ||
</quiz> | </quiz> | ||
| + | [[Category:Quizzes]] | ||
Revision as of 06:31, 18 October 2012
BBC 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 | |
| Brazil | South America | 8550000 | 182800000 | 564852000000 |
| Colombia | South America | 1140000 | 45600000 | |
| Nauru | Asia-Pacific | 21 | 9900 | |
| Uzbekistan | Central Asia | 447000 | 26000000 | |
| ... | ||||