Difference between revisions of "Nobel Quiz"

From SQLZOO
Jump to: navigation, search
Line 1: Line 1:
 
Nobel Quiz
 
Nobel Quiz
 
<quiz shuffle=none display=simple>
 
<quiz shuffle=none display=simple>
{Which of these shows the name of winner's names beginning with C and ending in n?
+
{Pick the code which shows the name of winner's names beginning with C and ending in n
 
|type="()"}
 
|type="()"}
 
- SELECT name FROM nobel WHERE winner LIKE '%C%' AND winner LIKE '%n%'
 
- SELECT name FROM nobel WHERE winner LIKE '%C%' AND winner LIKE '%n%'
Line 9: Line 9:
 
+ SELECT winner FROM nobel WHERE winner LIKE 'C%' AND winner LIKE '%n'
 
+ SELECT winner FROM nobel WHERE winner LIKE 'C%' AND winner LIKE '%n'
  
{Which of these shows how many Chemistry awards were given between 1950 and 1960?
+
{Select the code that shows how many Chemistry awards were given between 1950 and 1960?
 
|type="()"}
 
|type="()"}
 
- SELECT COUNT(subject) FROM nobel WHERE subject = 'Chemistry' AND BETWEEN 1950 and 1960
 
- SELECT COUNT(subject) FROM nobel WHERE subject = 'Chemistry' AND BETWEEN 1950 and 1960
Line 18: Line 18:
  
  
{Which of these shows the amount of years where no Medicine awards were given?
+
{Pick the code that shows the amount of years where no Medicine awards were given?
 
|type="()"}
 
|type="()"}
 
- SELECT COUNT(yr) FROM nobel WHERE subject NOT IN 'Medicine'
 
- SELECT COUNT(yr) FROM nobel WHERE subject NOT IN 'Medicine'
Line 26: Line 26:
 
- SELECT yr FROM nobel WHERE subject NOT LIKE 'Medicine'
 
- SELECT yr FROM nobel WHERE subject NOT LIKE 'Medicine'
  
{Which of these would show the year when neither a Physics or Chemistry award was given?
+
{Select the code which would show the year when neither a Physics or Chemistry award was given?
 
|type="()"}
 
|type="()"}
 
- SELECT yr FROM nobel WHERE subject NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
 
- SELECT yr FROM nobel WHERE subject NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
Line 34: Line 34:
 
- SELECT yr FROM subject WHERE yr NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
 
- SELECT yr FROM subject WHERE yr NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
  
{Which of these shows the years when a Medicine award was given but no Peace or Literature award was?
+
{Select the code which shows the years when a Medicine award was given but no Peace or Literature award was?
 
|type="()"}
 
|type="()"}
 
- SELECT DISTINCT yr FROM nobel WHERE subject='Medicine' and subject NOT IN(SELECT yr from nobel WHERE subject='Literature') and yr NOT IN (SELECT yr FROM nobel WHERE subject='Peace')
 
- SELECT DISTINCT yr FROM nobel WHERE subject='Medicine' and subject NOT IN(SELECT yr from nobel WHERE subject='Literature') and yr NOT IN (SELECT yr FROM nobel WHERE subject='Peace')

Revision as of 10:42, 23 July 2012

Nobel Quiz

1. Pick the code which shows the name of winner's names beginning with C and ending in n

SELECT name FROM nobel WHERE winner LIKE '%C%' AND winner LIKE '%n%'
SELECT name FROM nobel WHERE winner LIKE '%C' AND winner LIKE 'n%'
SELECT name FROM nobel WHERE winner LIKE 'C%' AND winner LIKE '%n'
SELECT winner FROM nobel WHERE winner LIKE '%C' AND winner LIKE 'n%'
SELECT winner FROM nobel WHERE winner LIKE 'C%' AND winner LIKE '%n'

2. Select the code that shows how many Chemistry awards were given between 1950 and 1960?

SELECT COUNT(subject) FROM nobel WHERE subject = 'Chemistry' AND BETWEEN 1950 and 1960
SELECT COUNT(subject) FROM nobel WHERE subject = 'Chemistry' AND yr BETWEEN (1950, 1960)
SELECT COUNT(subject) FROM nobel WHERE subject = 'Chemistry' AND yr BETWEEN 1950 and 1960
SELECT subject FROM nobel WHERE subject = 'Chemistry' AND yr BETWEEN 1950 and 1960
SELECT subject FROM nobel WHERE subject = 'Chemistry' AND yr BETWEEN (1950, 1960)

3. Pick the code that shows the amount of years where no Medicine awards were given?

SELECT COUNT(yr) FROM nobel WHERE subject NOT IN 'Medicine'
SELECT COUNT(yr) FROM nobel WHERE subject NOT LIKE 'Medicine'
SELECT COUNT(yr) FROM nobel WHERE subject NOT 'Medicine'
SELECT yr FROM nobel WHERE subject <> 'Medicine'
SELECT yr FROM nobel WHERE subject NOT LIKE 'Medicine'

4. Select the code which would show the year when neither a Physics or Chemistry award was given?

SELECT yr FROM nobel WHERE subject NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
SELECT yr FROM nobel WHERE subject NOT IN(SELECT subject from nobel WHERE subject IN ('Chemistry','Physics'))
SELECT yr FROM nobel WHERE yr NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))
SELECT yr FROM nobel WHERE yr NOT IN(SELECT subject from nobel WHERE subject IN ('Chemistry','Physics'))
SELECT yr FROM subject WHERE yr NOT IN(SELECT yr from nobel WHERE subject IN ('Chemistry','Physics'))

5. Select the code which shows the years when a Medicine award was given but no Peace or Literature award was?

SELECT DISTINCT yr FROM nobel WHERE subject='Medicine' and subject NOT IN(SELECT yr from nobel WHERE subject='Literature') and yr NOT IN (SELECT yr FROM nobel WHERE subject='Peace')
SELECT DISTINCT yr FROM nobel WHERE subject='Medicine' and yr NOT IN(SELECT yr from nobel WHERE subject='Literature' AND subject='Peace')
SELECT DISTINCT yr FROM nobel WHERE subject='Medicine' and yr NOT IN(SELECT yr from nobel WHERE subject='Literature') and yr NOT IN (SELECT yr FROM nobel WHERE subject='Peace')
SELECT DISTINCT yr FROM subject WHERE subject='Medicine' and yr NOT IN(SELECT yr from nobel WHERE subject='Literature' and subject='Peace')
SELECT DISTINCT yr FROM subject WHERE subject='Medicine' and yr NOT IN(SELECT yr from nobel WHERE subject='Literature') and yr NOT IN (SELECT yr FROM nobel WHERE subject='Peace')

Your score is 0 / 0
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense