Difference between revisions of "SELECT Quiz"

From SQLZOO
Jump to: navigation, search
(Created page with "SELECT quiz <quiz shuffle=none display=simple> {Which of these shows the countries with populations between 100000000 and 200000000 |type="()"} - SELECT name, population FROM ...")
 
Line 1: Line 1:
 
SELECT quiz
 
SELECT quiz
 
<quiz shuffle=none display=simple>
 
<quiz shuffle=none display=simple>
{Which of these shows the countries with populations between 100000000 and 200000000
+
{Select the code which shows the countries with a population between 100000000 and 200000000
 
|type="()"}
 
|type="()"}
 
- SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000)
 
- SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000)
Line 9: Line 9:
 
- SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
 
- SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
  
{Which of these shows the countries that end in A or L?
+
{Select the code which shows the countries that end in A or L
 
|type="()"}
 
|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'
Line 17: Line 17:
 
- 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)
{Which of these shows the sum population of scandinavia(Denmark, Finland, Sweden and Norway)?
+
 
|type="()"}
 
|type="()"}
 
- SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Finland','Sweden')
 
- SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Finland','Sweden')
Line 26: Line 25:
 
- SELECT SUM(population) FROM bbc WHERE name IN LIKE ('Denmark', 'Norway', 'Finland','Sweden')
 
- SELECT SUM(population) FROM bbc WHERE name IN LIKE ('Denmark', 'Norway', 'Finland','Sweden')
  
{Which of these 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="()"}
 
+ SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000
 
+ SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000
Line 34: Line 33:
 
- SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000
 
- SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000
  
{Which of these 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="()"}
 
- 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')

Revision as of 11:39, 23 July 2012

SELECT quiz

1. Select the code which shows the countries with a population between 100000000 and 200000000

SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000)
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

2. Select the code which shows the countries that end in A or L

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

3. Pick the code which shows the sum population of scandinavia(Denmark, Finland, Sweden and Norway)

SELECT SUM(population) FROM bbc WHERE name IN ('Denmark', 'Finland','Sweden')
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 LIKE ('Denmark', 'Norway', 'Finland' and 'Sweden')
SELECT SUM(population) FROM bbc WHERE name IN LIKE ('Denmark', 'Norway', 'Finland','Sweden')

4. Select the code that would show the countries with an area larger than 50000 and a population smaller than 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 name, area, population FROM bbc WHERE area < 50000 AND population > 10000000

5. Select the code that shows the population density of China, Australia, Nigeria and France

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

Your score is 0 / 0
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense