JOIN Quiz

From SQLZOO
Revision as of 09:17, 3 August 2012 by Connor (Talk | contribs)

Jump to: navigation, search

JOIN quiz

1. Select the code which shows player and mdate for players which scored during 9th June 2012 to 11th June 2012.

SELECT player, mdate FROM goal JOIN eteam ON (teamname=id) WHERE mdate IN ('9 June 2012','10 June 2012','11 June 2012')
SELECT player, mdate FROM goal JOIN game ON (matchid=id) WHERE mdate IN ('9 July 1912','10 July 1912','11 July 1912')
SELECT player, mdate FROM goal JOIN game ON (matchid=id) WHERE mdate IN ('9 June 2012','10 June 2012','11 June 2012')
SELECT player, mdate FROM goal JOIN game ON (matchid=id) WHERE mdate LIKE ('9 June 2012','10 June 2012','11 June 2012')
SELECT stadium, mdate FROM goal JOIN game ON (matchid=id) WHERE mdate IN ('9 June 2012','10 June 2012','11 June 2012')

2. Select the code which shows player, coach and COUNT(*) for players who scored in the first half of a match (0 - 45 minutes).

SELECT player, coach, COUNT(*) FROM goal JOIN eteam ON (id=teamid) WHERE gtime > 0 AND gtime < 45
SELECT player, coach, COUNT(*) FROM goal JOIN eteam ON (id=teamid) WHERE gtime > 0 AND gtime < 45 GROUP BY player
SELECT player, coach, COUNT(*) FROM goal JOIN eteam ON (id=teamid) WHERE gtime < 0 AND gtime > 45 GROUP BY player
SELECT player, coach, COUNT(*) FROM goal JOIN eteam ON (id=teamid) WHERE gtime > 0 AND gtime < 90 GROUP BY player
SELECT player, stadium, COUNT(*) FROM goal JOIN game ON (id=matchid) WHERE gtime > 0 AND gtime < 45 GROUP BY player

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