Difference between revisions of "BBC QUIZ"
m (The answer to question 3 was wrong. Numbers must not have apostrophes around them because that makes them strings. Also corrected grammar.) |
|||
Line 76: | Line 76: | ||
{Select the code which gives the name of countries beginning with U | {Select the code which gives the name of countries beginning with U | ||
|type="()"} | |type="()"} | ||
− | - SELECT name FROM bbc WHERE name BEGIN with C | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name BEGIN with C </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE name LIKE '%C' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE '%C' </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE name LIKE '%C%' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE '%C%' </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE name LIKE U | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE U </syntaxhighlight> |
− | + SELECT name FROM bbc WHERE name LIKE 'U%' | + | + <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE 'U%' </syntaxhighlight> |
{Select the code which shows just the population of United Kingdom? | {Select the code which shows just the population of United Kingdom? | ||
|type="()"} | |type="()"} | ||
− | - SELECT name FROM bbc WHERE name Like 'United%' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name Like 'United%' </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE population = 'United Kingdom' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE population = 'United Kingdom' </syntaxhighlight> |
− | - SELECT name, population FROM bbc WHERE name = 'United Kingdom' | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE name = 'United Kingdom' </syntaxhighlight> |
− | + SELECT population FROM bbc WHERE name = 'United Kingdom' | + | + <syntaxhighlight lang='sql'> SELECT population FROM bbc WHERE name = 'United Kingdom' </syntaxhighlight> |
− | - SELECT population FROM bbc WHERE name = United Kingdom | + | - <syntaxhighlight lang='sql'> SELECT population FROM bbc WHERE name = United Kingdom </syntaxhighlight> |
− | {Select the answer which shows the problem with this SQL code:SELECT name FROM "bbc" WHERE population > '2000000' | + | {Select the answer which shows the problem with this SQL code: |
+ | <syntaxhighlight lang='sql'> | ||
+ | SELECT name | ||
+ | FROM "bbc" | ||
+ | WHERE population > '2000000' | ||
+ | </syntaxhighlight> | ||
|type="()"} | |type="()"} | ||
- Apostrophes should be used around 'bbc' instead of speech marks | - Apostrophes should be used around 'bbc' instead of speech marks | ||
Line 98: | Line 103: | ||
- The use of a WHERE function is incorrect | - 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 | + | {Select the result that would be obtained from the following code: |
+ | <syntaxhighlight lang='sql'> | ||
+ | SELECT name, population / 10 | ||
+ | FROM bbc | ||
+ | WHERE population < 10000 | ||
+ | </syntaxhighlight> | ||
<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-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-B</caption><tr><td>Andorra</td><td>64000</td></tr><tr><td>Nauru</td><td>9900</td></tr></table> | ||
Line 113: | Line 123: | ||
{Select the code which would reveal the name and population of countries in Europe, North America and South America | {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') | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE region IN ('Europe', 'North America', 'South America') </syntaxhighlight> |
− | + SELECT name, population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | + | + <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') </syntaxhighlight> |
− | - SELECT name, population FROM bbc WHERE region IN (Europe North America South America) | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE region IN (Europe North America South America) </syntaxhighlight> |
− | - SELECT name, population FROM bbc WHERE region IS ('Europe', 'North America', 'South America') | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE region IS ('Europe', 'North America', 'South America') </syntaxhighlight> |
− | - SELECT population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') | + | - <syntaxhighlight lang='sql'> SELECT population FROM bbc WHERE region IN ('Europe', 'North America', 'South America') </syntaxhighlight> |
{Select the code which would give two rows | {Select the code which would give two rows | ||
|type="()"} | |type="()"} | ||
− | - SELECT name FROM bbc WHERE name = 'United Kingdom' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name = 'United Kingdom' </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE name = 'United Kingdom' AND name = 'Algeria' | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name = 'United Kingdom' AND name = 'Algeria' </syntaxhighlight> |
− | - SELECT name FROM bbc WHERE name EITHER ('United Kingdom', 'Algeria') | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name EITHER ('United Kingdom', 'Algeria') </syntaxhighlight> |
− | + SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria') | + | + <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria') </syntaxhighlight> |
− | - SELECT name FROM WHERE name IS 'Scotland' | + | - <syntaxhighlight lang='sql'> SELECT name FROM WHERE name IS 'Scotland' </syntaxhighlight> |
{Select the result that would be obtained from this code: | {Select the result that would be obtained from this code: |
Revision as of 10:41, 12 July 2013
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 | |
... |
<quiz shuffle=none display=simple> {Select the code which gives the name of countries beginning with U |type="()"}
-
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 U
+
SELECT name FROM bbc WHERE name LIKE 'U%'
{Select the code which shows just the population of United Kingdom? |type="()"}
-
SELECT name FROM bbc WHERE name Like 'United%'
-
SELECT name FROM bbc WHERE population = 'United Kingdom'
-
SELECT name, population FROM bbc WHERE name = 'United Kingdom'
+
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="()"} - Apostrophes should be used around 'bbc' instead of speech marks - There are apostrophes surrounding '2000000' - There are speech marks surrounding "bbc" + There are speech marks surrounding "bbc" and there are 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
Andorra | 6400 |
Nauru | 990 |
Andorra | 64000 |
Nauru | 9900 |
Nauru | 99 |
Nauru | 990 |
Nauru | 9900 |
|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="()"}
-
SELECT name FROM bbc WHERE region IN ('Europe', 'North America', 'South America')
+
SELECT name, population FROM bbc WHERE region IN ('Europe', 'North America', 'South America')
-
SELECT name, population FROM bbc WHERE region IN (Europe North America South America)
-
SELECT name, population FROM bbc WHERE region IS ('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="()"}
-
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 EITHER ('United Kingdom', 'Algeria')
+
SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria')
-
SELECT name FROM WHERE name IS 'Scotland'
{Select the result that would be obtained from this code:
SELECT name FROM bbc WHERE region = 'South America' AND population > 40000000
Afghanistan |
Brazil |
Colombia |
Brazil |
Brazil |
Colombia |
Brazil | South America |
Colombia | South America |
Brazil | 182800000 |
Colombia | 45600000 |
|type="()"} - Table-A - Table-B + Table-C - Table-D - Table-E </quiz>