Difference between revisions of "SELECT Quiz"

From SQLZOO
Jump to: navigation, search
Line 3: Line 3:
 
{Select the code which shows the countries with a population between 100000000 and 200000000
 
{Select the code which shows the countries with a population between 100000000 and 200000000
 
|type="()"}
 
|type="()"}
-A. SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000)
+
- SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000)
|| this is wrong
+
|| The correct syntax does not include brackets.
-B. SELECT name, population FROM bbc WHERE population BETWEEN 100000000, 200000000
+
- SELECT name, population FROM bbc WHERE population BETWEEN 100000000, 200000000
+C. SELECT name, population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
+
+ SELECT name, population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
-D. SELECT name, population FROM bbc WHERE area BETWEEN 100000000 AND 200000000
+
- SELECT name, population FROM bbc WHERE area BETWEEN 100000000 AND 200000000
-E. SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
+
- SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
  
 
{Select the code which shows the countries that end in A or L
 
{Select the code which shows the countries that end in A or L
 
|type="()"}
 
|type="()"}
-A. SELECT name FROM bbc WHERE name LIKE '%a' AND name LIKE '%l'
+
- SELECT name FROM bbc WHERE name LIKE '%a' AND name LIKE '%l'
-B. SELECT name FROM bbc WHERE name LIKE 'a%' AND name LIKE 'l%'
+
- SELECT name FROM bbc WHERE name LIKE 'a%' AND name LIKE 'l%'
-C. SELECT name FROM bbc WHERE name LIKE '%a' OR 'l%'
+
- SELECT name FROM bbc WHERE name LIKE '%a' OR 'l%'
+D. SELECT name FROM bbc WHERE name LIKE '%a' OR name LIKE '%l'
+
+ SELECT name FROM bbc WHERE name LIKE '%a' OR name LIKE '%l'
-E. SELECT name FROM bbc WHERE name LIKE 'a%' OR name LIKE 'l%'
+
- SELECT name FROM bbc WHERE name LIKE 'a%' OR name LIKE 'l%'
  
{Pick the code which shows the sum population of scandinavia(Denmark, Finland, Sweden and Norway)
+
{Pick the code which shows the total population of Scandinavia (Denmark, Finland, Sweden and Norway)
 
|type="()"}
 
|type="()"}
-A. SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Finland','Sweden')
+
+ SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')
+B. SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')
+
- SELECT population FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')
-C. SELECT population FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')
+
- SELECT SUM(population) FROM bbc WHERE name IN 'Scandinavia'
-D. SELECT SUM(population) FROM bbc WHERE name IN LIKE ('Denmark', 'Norway', 'Finland' and 'Sweden')
+
- SELECT SUM(population) FROM bbc WHERE name LIKE ('Denmark', 'Norway', 'Finland','Sweden')
-E. SELECT SUM(population) FROM bbc WHERE name IN LIKE ('Denmark', 'Norway', 'Finland','Sweden')
+
- SELECT TOTAL(population) FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')
  
 
{Select the code that would show the countries with an area larger than 50000 and a population smaller than 10000000
 
{Select the code that would show the countries with an area larger than 50000 and a population smaller than 10000000
 
|type="()"}
 
|type="()"}
+A. SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000
+
+ SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000
-B. SELECT name, area, population FROM bbc WHERE area < 50000 AND population < 10000000
+
- SELECT name, area, population FROM bbc WHERE area < 50000 AND population < 10000000
-C. SELECT name, area, population FROM bbc WHERE area = 50000 AND population = 10000000
+
- SELECT name, area, population FROM bbc WHERE area = 50000 AND population = 10000000
-D. SELECT name, area, population FROM bbc WHERE area > 50000 AND population > 10000000
+
- SELECT name, area, population FROM bbc WHERE area > 50000 AND population > 10000000
-E. SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000
+
- SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000
  
 
{Select the code that shows the population density of China, Australia, Nigeria and France
 
{Select the code that shows the population density of China, Australia, Nigeria and France
 
|type="()"}
 
|type="()"}
-A. SELECT name, area/population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
+
- SELECT name, area/population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
-B. SELECT name, area/population FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')
+
- SELECT name, area/population FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')
+C. SELECT name, population/area FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
+
+ SELECT name, population/area FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
-D. SELECT name, population/area FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')
+
- SELECT name, population/area FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')
-E. SELECT name, population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
+
- SELECT name, population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia')
 
</quiz>
 
</quiz>
  
 
[[Category:Quizzes]]
 
[[Category:Quizzes]]

Revision as of 14:12, 23 July 2012

SELECT quiz <quiz shuffle=none display=simple> {Select the code which shows the countries with a population between 100000000 and 200000000 |type="()"} - SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000) || The correct syntax does not include brackets. - SELECT name, population FROM bbc WHERE population BETWEEN 100000000, 200000000 + SELECT name, population FROM bbc WHERE population BETWEEN 100000000 AND 200000000 - SELECT name, population FROM bbc WHERE area BETWEEN 100000000 AND 200000000 - SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000

{Select the code which shows the countries that end in A or L |type="()"} - SELECT name FROM bbc WHERE name LIKE '%a' AND name LIKE '%l' - SELECT name FROM bbc WHERE name LIKE 'a%' AND name LIKE 'l%' - SELECT name FROM bbc WHERE name LIKE '%a' OR 'l%' + SELECT name FROM bbc WHERE name LIKE '%a' OR name LIKE '%l' - SELECT name FROM bbc WHERE name LIKE 'a%' OR name LIKE 'l%'

{Pick the code which shows the total population of Scandinavia (Denmark, Finland, Sweden and Norway) |type="()"} + SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden') - SELECT population FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden') - SELECT SUM(population) FROM bbc WHERE name IN 'Scandinavia' - SELECT SUM(population) FROM bbc WHERE name LIKE ('Denmark', 'Norway', 'Finland','Sweden') - SELECT TOTAL(population) FROM bbc WHERE name IN ('Denmark', 'Norway', 'Finland','Sweden')

{Select the code that would show the countries with an area larger than 50000 and a population smaller than 10000000 |type="()"} + SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000 - SELECT name, area, population FROM bbc WHERE area < 50000 AND population < 10000000 - SELECT name, area, population FROM bbc WHERE area = 50000 AND population = 10000000 - SELECT name, area, population FROM bbc WHERE area > 50000 AND population > 10000000 - SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000

{Select the code that shows the population density of China, Australia, Nigeria and France |type="()"} - SELECT name, area/population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') - SELECT name, area/population FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia') + SELECT name, population/area FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') - SELECT name, population/area FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia') - SELECT name, population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') </quiz>