Difference between revisions of "BBC QUIZ"

From SQLZOO
Jump to: navigation, search
m (The answer to question 3 was wrong. Numbers must not have apostrophes around them because that makes them strings. Also corrected grammar.)
(5 intermediate revisions by 2 users not shown)
Line 57: Line 57:
 
<td align='right'>21</td>
 
<td align='right'>21</td>
 
<td align='right'>9900</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>
 
<td></td>
 
</tr>
 
</tr>
Line 66: Line 74:
  
 
<quiz shuffle=none display=simple>
 
<quiz shuffle=none display=simple>
{Select the code which gives the name of countries beginning with C
+
{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 C
+
- SELECT name FROM bbc WHERE name LIKE U
+ SELECT name FROM bbc WHERE name LIKE 'C%'
+
+ SELECT name FROM bbc WHERE name LIKE 'U%'
  
 
{Select the code which shows just the population of United Kingdom?
 
{Select the code which shows just the population of United Kingdom?
Line 86: Line 94:
 
- Apostrophes should be used around 'bbc' instead of speech marks
 
- Apostrophes should be used around 'bbc' instead of speech marks
 
- There are apostrophes surrounding '2000000'
 
- There are apostrophes surrounding '2000000'
+ 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 are apostrophes surrounding '2000000'
 
- The use of a WHERE function is incorrect
 
- The use of a WHERE function is incorrect
  
Line 114: Line 122:
 
|type="()"}
 
|type="()"}
 
- SELECT name FROM bbc WHERE name = 'United Kingdom'
 
- SELECT name FROM bbc WHERE name = 'United Kingdom'
+ SELECT name FROM bbc WHERE name = 'United Kingdom' or name = 'Algeria'
+
- 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 EITHER ('United Kingdom', 'Algeria')
- SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria')
+
+ SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria')
 
- SELECT name FROM WHERE name IS 'Scotland'
 
- 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
+
{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-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-B</caption><tr><td>Brazil</td></tr></table>

Revision as of 03:09, 10 December 2012

BBC QUIZ

</tr>
bbc
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
...

1. Select the code which gives the name of countries beginning with U

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%'

2. Select the code which shows just the population of United Kingdom?

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

3. Select the answer which shows the problem with this SQL code:SELECT name FROM "bbc" WHERE population > '2000000'

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

4. Select the result that would be obtained from the following code: SELECT name, population / 10 FROM bbc WHERE population < 10000

Table-A
Andorra6400
Nauru990
Table-B
Andorra64000
Nauru9900
Table-C
Nauru99
Table-D
Nauru990
Table-E
Nauru9900
Table-A
Table-B
Table-C
Table-D
Table-E

5. Select the code which would reveal the name and population of countries in Europe, North America and South America

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')

6. Select the code which would give two rows

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'

7. Select the result that would be obtained from this code:

SELECT name FROM bbc WHERE region = 'South America' AND population > 40000000
Table-A
Afghanistan
Brazil
Colombia
Table-B
Brazil
Table-C
Brazil
Colombia
Table-D
BrazilSouth America
ColombiaSouth America
Table-E
Brazil182800000
Colombia45600000
Table-A
Table-B
Table-C
Table-D
Table-E

Your score is 0 / 0
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense