Difference between revisions of "BBC QUIZ"

From SQLZOO
Jump to: navigation, search
(Clarified question 3.)
 
(34 intermediate revisions by 7 users not shown)
Line 1: Line 1:
BBC QUIZ
+
{{Languages}}
<quiz shuffle=none display=simple class='hover'>
+
<div class='ref_section'>
{Select the code which gives the name of countries beginning with C
+
<table class='db_ref'>
|type="()"}
+
<caption>world</caption>
<input type='radio' name='q0'[A. SELECT name FROM bbc WHERE name BEGIN with C]' value='1' /><label>A. SELECT name FROM bbc WHERE name BEGIN with C</label>
+
<tr>
-A. SELECT name FROM bbc WHERE name BEGIN with C
+
<th>name</th>
<input type='radio' name='q0'[B. SELECT name FROM bbc WHERE name LIKE '%C']' value='2' /><label>B. SELECT name FROM bbc WHERE name LIKE '%C'</label>
+
<th>continent</th>
-B. SELECT name FROM bbc WHERE name LIKE '%C'
+
<th>area</th>
<input type='radio' name='q0'[C. SELECT name FROM bbc WHERE name LIKE '%C%']' value='3' /><label>C. SELECT name FROM bbc WHERE name LIKE '%C%'</label>
+
<th>population</th>
-C. SELECT name FROM bbc WHERE name LIKE '%C%'
+
<th>gdp</th>
<input type='radio' name='q0'[D. SELECT name FROM bbc WHERE name LIKE C]' value='4' /><label>D. SELECT name FROM bbc WHERE name LIKE C</label>
+
</tr>
-D. SELECT name FROM bbc WHERE name LIKE C
+
<tr>
<input type='radio' name='q0'[E. SELECT name FROM bbc WHERE name LIKE 'C%']' value='5' /><label>E. SELECT name FROM bbc WHERE name LIKE 'C%'</label>
+
<td>Afghanistan</td>
+E. SELECT name FROM bbc WHERE name LIKE 'C%'
+
<td>South Asia</td>
 
+
<td align='right'>652225</td>
{Select the code which shows just the population of United Kingdom?
+
<td align='right'>26000000</td>
|type="()"}
+
<td></td>
- A. SELECT name FROM bbc WHERE name Like 'United%'
+
</tr>
- B. SELECT name FROM bbc WHERE population = 'United Kingdom'
+
<tr>
- C. SELECT name, population FROM bbc WHERE name = 'United Kingdom'
+
<td>Albania</td>
+ D. SELECT population FROM bbc WHERE name = 'United Kingdom'
+
<td>Europe</td>
- E. SELECT population FROM bbc WHERE name = United Kingdom
+
<td align='right'>28728</td>
 
+
<td align='right'>3200000</td>
{Select the answer which shows the problem with this SQL code:SELECT name FROM "bbc" WHERE population > '2000000'
+
<td align='right'>6656000000</td>
|type="()"}
+
</tr>
- A. Apostrophes should be used around 'bbc' instead of speech marks
+
<tr>
- B. There are apostrophes surrounding '2000000'
+
<td>Algeria</td>
+ C. There are speech marks surrounding "bbc"
+
<td>Middle East</td>
- D. There are speech marks surrounding "bbc" and there is apostrophes surrounding '2000000'
+
<td align='right'>2400000</td>
- E. The use of a WHERE function is incorrect
+
<td align='right'>32900000</td>
 
+
<td align='right'>75012000000</td>
{Select the code which would reveal the name and population of countries in Europe, North America and South America
+
</tr>
|type="()"}
+
<tr>
- A. SELECT name FROM bbc WHERE region IN ('Europe', 'North America', 'South America')
+
<td>Andorra</td>
+ B. SELECT name, population FROM bbc WHERE region IN ('Europe', 'North America', 'South America')
+
<td>Europe</td>
- C. SELECT name, population FROM bbc WHERE region IN (Europe North America South America)
+
<td align='right'>468</td>
- D. SELECT name, population FROM bbc WHERE region IS ('Europe', 'North America', 'South America')
+
<td align='right'>64000</td>
- E. SELECT population FROM bbc WHERE region IN ('Europe', 'North America', 'South America')
+
<td></td>
 
+
</tr>
{Select the code which would give two rows
+
<tr>
|type="()"}
+
<td>Brazil</td>
- A. SELECT name FROM bbc WHERE name = 'United Kingdom'
+
<td>South America</td>
+ B. SELECT name FROM bbc WHERE name = 'United Kingdom' or name = 'Algeria'
+
<td align='right'>8550000</td>
- C. SELECT name FROM bbc WHERE name EITHER ('United Kingdom', 'Algeria')
+
<td align='right'>182800000</td>
- D. SELECT name FROM bbc WHERE name IN ('United Kingdom', 'Algeria')
+
<td>564852000000</td>
- E. SELECT name FROM WHERE name IS 'Scotland'
+
</tr>
</quiz>
+
<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>
 +
<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>
  
 +
<div class=quiz>
 +
<div class=q>Select the code which gives the name of countries beginning with U
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE name
 +
BEGIN with U</syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE name LIKE '%U' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE name LIKE '%u%' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE name LIKE U </syntaxhighlight>
 +
<syntaxhighlight class='d y' lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE name LIKE 'U%' </syntaxhighlight>
 +
</div>
 +
<div class=q>Select the code which shows just the population of United Kingdom?
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT population
 +
  FROM 'United Kingdom' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE population = 'United Kingdom' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT FROM world
 +
WHERE population IN 'United Kingdom' </syntaxhighlight>
 +
<syntaxhighlight class='d y' lang='sql'>
 +
SELECT population
 +
  FROM world
 +
WHERE name = 'United Kingdom' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT population
 +
  FROM world
 +
WHERE 'United Kingdom' IN name </syntaxhighlight>
 +
</div>
 +
<div class=q>Select the answer which shows the problem with this SQL code - the intended result should be the continent of France:
 +
<syntaxhighlight lang='sql'>
 +
SELECT continent
 +
  FROM world
 +
  WHERE 'name' = 'France'
 +
</syntaxhighlight>
 +
<div class=d>continent should be 'continent'</div>
 +
<div class='d y'>'name' should be name</div>
 +
<div class=d>'France' should be "France"</div>
 +
<div class=d>'France' should be France</div>
 +
<div class=d>= should be IN</div>
 +
</div>
 +
<div class=q>Select the result that would be obtained from the following code:
 +
<syntaxhighlight lang='sql'>
 +
SELECT name, population / 10
 +
  FROM world
 +
WHERE population < 10000
 +
</syntaxhighlight>
 +
<table class=d><tr><td>Andorra</td><td>6400</td></tr><tr><td>Nauru</td><td>990</td></tr></table>
 +
<table class=d><tr><td>Andorra</td><td>64000</td></tr><tr><td>Nauru</td><td>9900</td></tr></table>
 +
<table class=d><tr><td>Nauru</td><td>99</td></tr></table>
 +
<table class='d y'><tr><td>Nauru</td><td>990</td></tr></table>
 +
<table class=d><tr><td>Nauru</td><td>9900</td></tr></table>
 +
</div>
 +
<div class=q>Select the code which would reveal the name and population of countries in Europe and Asia
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name
 +
  FROM world
 +
WHERE continent IN ('Europe', 'Asia') </syntaxhighlight>
 +
<syntaxhighlight class='d y' lang='sql'>
 +
SELECT name, population
 +
  FROM world
 +
WHERE continent IN ('Europe', 'Asia') </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name, population
 +
  FROM world
 +
WHERE name IN (Europe Asia) </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name, population
 +
  FROM world
 +
WHERE name IS ('Europe', 'Asia') </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name, population
 +
  FROM world
 +
WHERE continent = ('Europe', 'Asia') </syntaxhighlight>
 +
</div>
 +
<div class=q >Select the code which would give two rows
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name FROM world
 +
WHERE name = 'Cuba' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name FROM world
 +
WHERE name = 'Cuba'
 +
  AND name = 'Togo' </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name FROM world
 +
WHERE name EITHER ('Cuba', 'Togo') </syntaxhighlight>
 +
<syntaxhighlight class='d y' lang='sql'>
 +
SELECT name FROM world
 +
WHERE name IN ('Cuba', 'Togo') </syntaxhighlight>
 +
<syntaxhighlight class=d lang='sql'>
 +
SELECT name FROM WHERE name IS 'Mali' </syntaxhighlight>
 +
</div>
 +
<div class=q>Select the result that would be obtained from this code:
 +
<source lang='SQL'>
 +
SELECT name FROM world
 +
WHERE continent = 'South America'
 +
  AND population > 40000000</source>
 +
<table class=d><tr><td>Afghanistan</td></tr><tr><td>Brazil</td></tr><tr><td>Colombia</td></tr></table>
 +
<table class=d><tr><td>Brazil</td></tr></table>
 +
<table class='d y'><tr><td>Brazil</td></tr><tr><td>Colombia</td></tr></table>
 +
<table class=d><tr><td>Brazil</td><td>South America</td></tr><tr><td>Colombia</td><td>South America</td></tr></table>
 +
<table class=d><tr><td>Brazil</td><td>182800000</td></tr><tr><td>Colombia</td><td>45600000</td></tr></table>
 +
</div>
 +
</div>
 
[[Category:Quizzes]]
 
[[Category:Quizzes]]

Latest revision as of 20:26, 2 March 2016

Language: English  • 中文
world
name continent 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
...
Select the code which gives the name of countries beginning with U
SELECT name
  FROM world
 WHERE name
 BEGIN with U
SELECT name
  FROM world
 WHERE name LIKE '%U'
SELECT name
  FROM world
 WHERE name LIKE '%u%'
SELECT name
  FROM world
 WHERE name LIKE U
SELECT name
  FROM world
 WHERE name LIKE 'U%'
Select the code which shows just the population of United Kingdom?
SELECT population
  FROM 'United Kingdom'
SELECT name
  FROM world
 WHERE population = 'United Kingdom'
SELECT FROM world
 WHERE population IN 'United Kingdom'
SELECT population
  FROM world
 WHERE name = 'United Kingdom'
SELECT population
  FROM world
 WHERE 'United Kingdom' IN name
Select the answer which shows the problem with this SQL code - the intended result should be the continent of France:
 SELECT continent 
   FROM world 
  WHERE 'name' = 'France'
continent should be 'continent'
'name' should be name
'France' should be "France"
'France' should be France
= should be IN
Select the result that would be obtained from the following code:
 SELECT name, population / 10 
  FROM world 
 WHERE population < 10000
Andorra6400
Nauru990
Andorra64000
Nauru9900
Nauru99
Nauru990
Nauru9900
Select the code which would reveal the name and population of countries in Europe and Asia
SELECT name
  FROM world 
 WHERE continent IN ('Europe', 'Asia')
SELECT name, population
  FROM world
 WHERE continent IN ('Europe', 'Asia')
SELECT name, population
  FROM world
 WHERE name IN (Europe Asia)
SELECT name, population
  FROM world
 WHERE name IS ('Europe', 'Asia')
SELECT name, population
  FROM world
 WHERE continent = ('Europe', 'Asia')
Select the code which would give two rows
SELECT name FROM world
 WHERE name = 'Cuba'
SELECT name FROM world
 WHERE name = 'Cuba'
   AND name = 'Togo'
SELECT name FROM world
 WHERE name EITHER ('Cuba', 'Togo')
SELECT name FROM world
 WHERE name IN ('Cuba', 'Togo')
SELECT name FROM WHERE name IS 'Mali'
Select the result that would be obtained from this code:
SELECT name FROM world
 WHERE continent = 'South America'
   AND population > 40000000
Afghanistan
Brazil
Colombia
Brazil
Brazil
Colombia
BrazilSouth America
ColombiaSouth America
Brazil182800000
Colombia45600000