Difference between revisions of "SELECT Quiz"
(21 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
SELECT quiz | SELECT quiz | ||
+ | <div class="ref_section"> | ||
+ | <table class='db_ref'><tr> | ||
+ | <th>name</th> | ||
+ | <th>region</th> | ||
+ | <th>area</th> | ||
+ | <th>population</th> | ||
+ | <th>gdp</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Afghanistan</td> | ||
+ | <td>South Asia</td> | ||
+ | <td align='right'>652225</td> | ||
+ | <td align='right'>26000000</td> | ||
+ | <td></td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Albania</td> | ||
+ | <td>Europe</td> | ||
+ | <td align='right'>28728</td> | ||
+ | <td align='right'>3200000</td> | ||
+ | <td align='right'>6656000000</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Algeria</td> | ||
+ | <td>Middle East</td> | ||
+ | <td align='right'>2400000</td> | ||
+ | <td align='right'>32900000</td> | ||
+ | <td align='right'>75012000000</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Andorra</td> | ||
+ | <td>Europe</td> | ||
+ | <td align='right'>468</td> | ||
+ | <td align='right'>64000</td> | ||
+ | <td></td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td colspan='5'>...</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </div> | ||
<quiz shuffle=none display=simple> | <quiz shuffle=none display=simple> | ||
{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="()"} | ||
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE area BETWEEN 100000000 AND 200000000 </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE population BETWEEN (100000000, 200000000) </syntaxhighlight> |
− | + | + | + <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE population BETWEEN 100000000 AND 200000000 </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE population BETWEEN 100000000, 200000000 </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000 </syntaxhighlight> |
+ | |||
+ | {Pick the result you would obtain from this code: | ||
+ | <syntaxhighlight lang='sql'> | ||
+ | SELECT name, population | ||
+ | FROM bbc | ||
+ | WHERE name LIKE "Al%"</syntaxhighlight> | ||
+ | <table style='float:left'><caption>Table-A</caption> | ||
+ | <tr> | ||
+ | <td>Albania</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Algeria</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-B</caption> | ||
+ | <tr> | ||
+ | <td>%bania</td> | ||
+ | <td>3200000</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>%geria</td> | ||
+ | <td>32900000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-C</caption><tr> | ||
+ | <td>Al</td> | ||
+ | <td>0 </td></tr></table> | ||
+ | <table style='float:left'><caption>Table-D</caption><tr> | ||
+ | <td>Albania</td> | ||
+ | <td>3200000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-E</caption> | ||
+ | <tr> | ||
+ | <td>Albania</td> | ||
+ | <td>3200000</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Algeria</td> | ||
+ | <td>32900000</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |type="()"} | ||
+ | - Table-A | ||
+ | - Table-B | ||
+ | - Table-C | ||
+ | - Table-D | ||
+ | + Table-E | ||
{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="()"} | ||
− | - | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE 'a%' AND name LIKE 'l%' </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE 'a%' OR name LIKE 'l%' </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE '%a' AND name LIKE '%l' </syntaxhighlight> |
− | + | - <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE '%a' OR 'l%' </syntaxhighlight> | |
− | + | + <syntaxhighlight lang='sql'> SELECT name FROM bbc WHERE name LIKE '%a' OR name LIKE '%l' </syntaxhighlight> | |
+ | |||
+ | {Pick the result from the query | ||
+ | <syntaxhighlight lang='sql'> | ||
+ | SELECT name,length(name) | ||
+ | FROM world | ||
+ | WHERE length(name)=5 and continent='Europe' | ||
+ | </syntaxhighlight> | ||
+ | <table><caption>Table-A</caption><tr><th>name</th><th>length(name)</th></tr><tr><td>Benin</td><td class="r">5</td></tr><tr><td>Lybia</td><td class="r">5</td></tr><tr><td>Egypt</td><td class="r">5</td></tr></table> | ||
+ | <table><caption>Table-B</caption><tr><th>name</th><th>length(name)</th></tr><tr><td>Italy</td><td class="r">5</td></tr><tr><td>Egypt</td><td class="r">5</td></tr><tr><td>Spain</td><td class="r">5</td></tr></table> | ||
+ | <table><caption>Table-C</caption><tr><th>name</th><th>length(name)</th></tr><tr><td>Italy</td><td class="r">5</td></tr><tr><td>Malta</td><td class="r">5</td></tr><tr><td>Spain</td><td class="r">5</td></tr></table> | ||
+ | <table><caption>Table-D</caption><tr><th>name</th><th>length(name)</th></tr><tr><td>Italy</td><td class="r">5</td></tr><tr><td>France</td><td class="r">6</td></tr><tr><td>Spain</td><td class="r">5</td></tr></table> | ||
+ | <table><caption>Table-E</caption><tr><th>name</th><th>length(name)</th></tr><tr><td>Sweden</td><td class="r">6</td></tr><tr><td>Norway</td><td class="r">6</td></tr><tr><td>Poland</td><td class="r">6</td></tr></table> | ||
+ | |type="()"} | ||
+ | - Table-A | ||
+ | - Table-B | ||
+ | + Table-C | ||
+ | - Table-D | ||
+ | - Table-E | ||
− | {Pick the code | + | {Pick the result you would obtain from this code: |
+ | <syntaxhighlight lang='sql'>SELECT name, area * 2 FROM bbc WHERE population = 64000</syntaxhighlight> | ||
+ | <table style='float:left'><caption>Table-A</caption><tr><td>Andorra</td><td>234</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-B</caption><tr><td>Andorra</td><td>468</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-C</caption><tr><td>Andorra</td><td>936 </td></tr></table> | ||
+ | <table style='float:left'><caption>Table-D</caption><tr><td>Andorra</td><td>4680</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-E</caption><tr><td>Andorra</td><td>936</td></tr><tr><td>Albania</td><td>57456</td></tr></table> | ||
|type="()"} | |type="()"} | ||
− | -A | + | - Table-A |
− | + | - Table-B | |
− | -C | + | + Table-C |
− | -D | + | - Table-D |
− | -E | + | - Table-E |
{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="()"} | ||
− | + | - <syntaxhighlight lang='sql'> SELECT name, area, population FROM bbc WHERE area < 50000 AND population < 10000000 </syntaxhighlight> | |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, area, population FROM bbc WHERE area < 50000 AND population > 10000000 </syntaxhighlight> |
− | + | + <syntaxhighlight lang='sql'> SELECT name, area, population FROM bbc WHERE area > 50000 AND population < 10000000 </syntaxhighlight> | |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, area, population FROM bbc WHERE area > 50000 AND population > 10000000 </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, area, population FROM bbc WHERE area = 50000 AND population = 10000000 </syntaxhighlight> |
{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="()"} | ||
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, area/population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, area/population FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia') </syntaxhighlight> |
− | + | + | + <syntaxhighlight lang='sql'> SELECT name, population/area FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, population/area FROM bbc WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia') </syntaxhighlight> |
− | - | + | - <syntaxhighlight lang='sql'> SELECT name, population FROM bbc WHERE name IN ('China', 'Nigeria', 'France', 'Australia') </syntaxhighlight> |
+ | |||
+ | {Pick the result that would be obtained from this code: SELECT CONCAT(name,region), population FROM bbc WHERE region IN ('Africa','Middle East') AND name LIKE 'A%' | ||
+ | <table style='float:left'><caption>Table-A</caption><tr><td>(Algeria, Middle East)</td><td>32900000</td></tr><tr><td>(Angola, Africa)</td><td>14500000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-B</caption><tr><td>Algeria</td><td>32900000</td></tr><tr><td>Angola</td><td>14500000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-C</caption><tr><td>AlgeriaMiddle East</td><td>32900000</td></tr><tr><td>AngolaAfrica</td><td>14500000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-D</caption><tr><td>AngolaAfrica</td><td> 14500000</td></tr></table> | ||
+ | <table style='float:left'><caption>Table-E</caption><tr><td>Algeria</td><td>Middle East</td></tr><tr><td>Angola</td><td>Africa</td></tr></table> | ||
+ | |type="()"} | ||
+ | - Table-A | ||
+ | - Table-B | ||
+ | + Table-C | ||
+ | - Table-D | ||
+ | - Table-E | ||
+ | |||
</quiz> | </quiz> | ||
[[Category:Quizzes]] | [[Category:Quizzes]] |
Revision as of 10:38, 12 July 2013
SELECT quiz
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 | |
... |
<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 area BETWEEN 100000000 AND 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 population BETWEEN 100000000, 200000000
SELECT population FROM bbc WHERE population BETWEEN 100000000 AND 200000000
{Pick the result you would obtain from this code:
SELECT name, population
FROM bbc
WHERE name LIKE "Al%"
Albania |
Algeria |
%bania | 3200000 |
%geria | 32900000 |
Al | 0 |
Albania | 3200000 |
Albania | 3200000 |
Algeria | 32900000 |
|type="()"} - Table-A - Table-B - Table-C - Table-D + Table-E
{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%' OR 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'
{Pick the result from the query
SELECT name,length(name)
FROM world
WHERE length(name)=5 and continent='Europe'
name | length(name) |
---|---|
Benin | 5 |
Lybia | 5 |
Egypt | 5 |
name | length(name) |
---|---|
Italy | 5 |
Egypt | 5 |
Spain | 5 |
name | length(name) |
---|---|
Italy | 5 |
Malta | 5 |
Spain | 5 |
name | length(name) |
---|---|
Italy | 5 |
France | 6 |
Spain | 5 |
name | length(name) |
---|---|
Sweden | 6 |
Norway | 6 |
Poland | 6 |
|type="()"} - Table-A - Table-B + Table-C - Table-D - Table-E
{Pick the result you would obtain from this code:
SELECT name, area * 2 FROM bbc WHERE population = 64000
Andorra | 234 |
Andorra | 468 |
Andorra | 936 |
Andorra | 4680 |
Andorra | 936 |
Albania | 57456 |
|type="()"} - Table-A - Table-B + Table-C - Table-D - Table-E
{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')
{Pick the result that would be obtained from this code: SELECT CONCAT(name,region), population FROM bbc WHERE region IN ('Africa','Middle East') AND name LIKE 'A%'
(Algeria, Middle East) | 32900000 |
(Angola, Africa) | 14500000 |
Algeria | 32900000 |
Angola | 14500000 |
AlgeriaMiddle East | 32900000 |
AngolaAfrica | 14500000 |
AngolaAfrica | 14500000 |
Algeria | Middle East |
Angola | Africa |
|type="()"} - Table-A - Table-B + Table-C - Table-D - Table-E
</quiz>