Difference between revisions of "BBC QUIZ"

From SQLZOO
Jump to: navigation, search
(Clarified question 3.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Languages}}
 
<div class='ref_section'>
 
<div class='ref_section'>
 
<table class='db_ref'>
 
<table class='db_ref'>
<caption>bbc</caption>
+
<caption>world</caption>
 
<tr>
 
<tr>
 
<th>name</th>
 
<th>name</th>
<th>region</th>
+
<th>continent</th>
 
<th>area</th>
 
<th>area</th>
 
<th>population</th>
 
<th>population</th>
Line 75: Line 76:
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE name
 
  WHERE name
 
  BEGIN with U</syntaxhighlight>
 
  BEGIN with U</syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE name LIKE '%U' </syntaxhighlight>
 
  WHERE name LIKE '%U' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE name LIKE '%u%' </syntaxhighlight>
 
  WHERE name LIKE '%u%' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE name LIKE U </syntaxhighlight>
 
  WHERE name LIKE U </syntaxhighlight>
 
<syntaxhighlight class='d y' lang='sql'>
 
<syntaxhighlight class='d y' lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE name LIKE 'U%' </syntaxhighlight>
 
  WHERE name LIKE 'U%' </syntaxhighlight>
 
</div>
 
</div>
Line 101: Line 102:
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
 
  WHERE population = 'United Kingdom' </syntaxhighlight>
 
  WHERE population = 'United Kingdom' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
SELECT FROM bbc
+
SELECT FROM world
 
  WHERE population IN 'United Kingdom' </syntaxhighlight>
 
  WHERE population IN 'United Kingdom' </syntaxhighlight>
 
<syntaxhighlight class='d y' lang='sql'>
 
<syntaxhighlight class='d y' lang='sql'>
 
SELECT population
 
SELECT population
   FROM bbc
+
   FROM world
 
  WHERE name = 'United Kingdom' </syntaxhighlight>
 
  WHERE name = 'United Kingdom' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT population
 
SELECT population
   FROM bbc
+
   FROM world
 
  WHERE 'United Kingdom' IN name </syntaxhighlight>
 
  WHERE 'United Kingdom' IN name </syntaxhighlight>
 
</div>
 
</div>
<div class=q>Select the answer which shows the problem with this SQL code - the indended result should be the single row containing 'Europe':
+
<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'>
 
<syntaxhighlight lang='sql'>
  SELECT region
+
  SELECT continent
   FROM bbc
+
   FROM world
 
   WHERE 'name' = 'France'
 
   WHERE 'name' = 'France'
 
</syntaxhighlight>
 
</syntaxhighlight>
<div class=d>region should be 'region'</div>
+
<div class=d>continent should be 'continent'</div>
 
<div class='d y'>'name' should be name</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>
Line 130: Line 131:
 
<syntaxhighlight lang='sql'>
 
<syntaxhighlight lang='sql'>
 
  SELECT name, population / 10  
 
  SELECT name, population / 10  
   FROM bbc
+
   FROM world
 
  WHERE population < 10000
 
  WHERE population < 10000
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 142: Line 143:
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name
 
SELECT name
   FROM bbc
+
   FROM world
  WHERE region IN ('Europe', 'Asia') </syntaxhighlight>
+
  WHERE continent IN ('Europe', 'Asia') </syntaxhighlight>
 
<syntaxhighlight class='d y' lang='sql'>
 
<syntaxhighlight class='d y' lang='sql'>
 
SELECT name, population
 
SELECT name, population
   FROM bbc
+
   FROM world
  WHERE region IN ('Europe', 'Asia') </syntaxhighlight>
+
  WHERE continent IN ('Europe', 'Asia') </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name, population
 
SELECT name, population
   FROM bbc
+
   FROM world
 
  WHERE name IN (Europe Asia) </syntaxhighlight>
 
  WHERE name IN (Europe Asia) </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name, population
 
SELECT name, population
   FROM bbc
+
   FROM world
 
  WHERE name IS ('Europe', 'Asia') </syntaxhighlight>
 
  WHERE name IS ('Europe', 'Asia') </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
 
SELECT name, population
 
SELECT name, population
   FROM bbc
+
   FROM world
  WHERE region = ('Europe', 'Asia') </syntaxhighlight>
+
  WHERE continent = ('Europe', 'Asia') </syntaxhighlight>
 
</div>
 
</div>
 
<div class=q >Select the code which would give two rows
 
<div class=q >Select the code which would give two rows
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
SELECT name FROM bbc
+
SELECT name FROM world
 
  WHERE name = 'Cuba' </syntaxhighlight>
 
  WHERE name = 'Cuba' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
SELECT name FROM bbc
+
SELECT name FROM world
 
  WHERE name = 'Cuba'
 
  WHERE name = 'Cuba'
 
   AND name = 'Togo' </syntaxhighlight>
 
   AND name = 'Togo' </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
SELECT name FROM bbc
+
SELECT name FROM world
 
  WHERE name EITHER ('Cuba', 'Togo') </syntaxhighlight>
 
  WHERE name EITHER ('Cuba', 'Togo') </syntaxhighlight>
 
<syntaxhighlight class='d y' lang='sql'>
 
<syntaxhighlight class='d y' lang='sql'>
SELECT name FROM bbc
+
SELECT name FROM world
 
  WHERE name IN ('Cuba', 'Togo') </syntaxhighlight>
 
  WHERE name IN ('Cuba', 'Togo') </syntaxhighlight>
 
<syntaxhighlight class=d lang='sql'>
 
<syntaxhighlight class=d lang='sql'>
Line 180: Line 181:
 
<div class=q>Select the result that would be obtained from this code:  
 
<div class=q>Select the result that would be obtained from this code:  
 
<source lang='SQL'>
 
<source lang='SQL'>
SELECT name FROM bbc
+
SELECT name FROM world
  WHERE region = 'South America'
+
  WHERE continent = 'South America'
 
   AND population > 40000000</source>
 
   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>Afghanistan</td></tr><tr><td>Brazil</td></tr><tr><td>Colombia</td></tr></table>
Line 190: Line 191:
 
</div>
 
</div>
 
</div>
 
</div>
[[Category:Quiz]]
+
[[Category:Quizzes]]

Latest revision as of 20:26, 2 March 2016

Language:Project:Language policy 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