Difference between revisions of "JOIN Quiz"

From SQLZOO
Jump to: navigation, search
(Created page with "JOIN quiz <quiz shuffle=none display=simple> {Which of following would show all the previous men's singles table tennis gold medalists? |type="()"} - SELECT country.name, colo...")
 
Line 1: Line 1:
 
JOIN quiz
 
JOIN quiz
 
<quiz shuffle=none display=simple>
 
<quiz shuffle=none display=simple>
{Which of following would show all the previous men's singles table tennis gold medalists?
+
{SELECT the code which shows the players and their teams who have scored goals against Poland before.
 
|type="()"}
 
|type="()"}
 
- SELECT country.name, color FROM ttms JOIN country ON (ttms.country=country.id) WHERE color = 'gold'
 
- SELECT country.name, color FROM ttms JOIN country ON (ttms.country=country.id) WHERE color = 'gold'

Revision as of 14:32, 1 August 2012

JOIN quiz

1. SELECT the code which shows the players and their teams who have scored goals against Poland before.

SELECT country.name, color FROM ttms JOIN country ON (ttms.country=country.id) WHERE color = 'gold'
SELECT who, country.name, color FROM ttms JOIN country (ttms.country=country.id) WHERE color = 'gold'
SELECT who, country.name, color FROM ttms JOIN country ON (ttms.country=country.id) WHERE color = 'gold'
SELECT who, country.name, color FROM ttms JOIN country ON (ttms.country=country.id) WHERE color = 'silver'
SELECT who, country.name, color FROM ttms JOIN country WITH (ttms.country=country.id) WHERE color = 'gold'

2. Which of the following shows the chinese woman's singles winners in the Seoul and Barcelona games?

SELECT city FROM ttws JOIN games ON (ttws.games=games.yr) WHERE city IN ('Barcelona', 'Seoul') AND ttws.country = 'CHN'
SELECT who, city FROM ttws JOIN games IN (ttws.games=games.yr) WHERE city IN ('Barcelona', 'Seoul') AND ttws.country = 'CHN'
SELECT who, city FROM ttws JOIN games ON (ttws.games=games.yr) WHERE city IN ('Barcelona', 'Atlanta') AND ttws.country = 'CHN'
SELECT who, city FROM ttws JOIN games ON (ttws.games=games.yr) WHERE city IN ('Barcelona', 'Seoul') AND ttws.country = 'CHN'
SELECT who, city FROM ttws JOIN games ON (ttws.games=games.yr) WHERE city IN ('Beijing', 'Seoul') AND ttws.country = 'CHN'

3. Which of these shows the korean women's singles winners in order of medal achieved(Ascending order)?

SELECT ttws.country, city, color FROM ttws JOIN games ON (ttws.games=games.yr) WHERE ttws.country = 'CHN' ORDER BY color ASC
SELECT who, ttws.country, city, color FROM ttws JOIN games ON (ttws.games=games.yr) WHERE ttws.country = 'CHN' ORDER BY color ASC
SELECT who, ttws.country, city, color FROM ttws JOIN games ON (ttws.games=games.yr) WHERE ttws.country = 'CHN' ORDER BY country ASC
SELECT who, ttws.country, city, color FROM ttws JOIN games ON (ttws.games=games.yr) WHERE ttws.country = 'CHN' ORDER BY color DESC
SELECT who, ttws.country, city, color FROM ttws JOIN games ON (ttws.games=games.yr) WHERE who = 'CHN' ORDER BY color ASC

4. Which of these shows the gold medalists for the men's doubles from 1992 to 2000?

SELECT name, color, games FROM ttmd JOIN team ON team=team.id WHERE color='gold' AND games BETWEEN 1992 and 2000
SELECT name, color, games FROM ttmd JOIN team ON team=team.id WHERE color='gold' AND games BETWEEN 2092 and 3000
SELECT name, color, games FROM ttmd JOIN team ON team=team.id WHERE color='gold' AND WHERE games BETWEEN 1992 and 2000
SELECT name, color, games FROM ttmd JOIN team ON team=team.id WHERE color='silver' AND games BETWEEN 1992 and 2000
SELECT name, color, games FROM ttmd JOIN team WITH team=team.id WHERE color='gold' AND games BETWEEN 1992 and 2000

5. Which of the following shows the men's doubles chinese gold medalists who have names beginning with w?

SELECT FROM ttmd JOIN team ON team=team.id WHERE country = 'CHN' AND color = 'gold' AND name LIKE 'W%'
SELECT name, color, country FROM ttmd JOIN team ON team=team.id WHERE country = 'CHN' AND color = 'gold' AND name IN 'W%'
SELECT name, color, country FROM ttmd JOIN team ON team=team.id WHERE country = 'CHN' AND color = 'gold' AND name LIKE '%W'
SELECT name, color, country FROM ttmd JOIN team ON team=team.id WHERE country = 'CHN' AND color = 'gold' AND name LIKE 'W%'
SELECT name, color, country FROM ttmd JOIN team ON team=team.id WHERE country = 'CHN' AND color = 'silver' AND name LIKE 'W%'

Your score is 0 / 0
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense