1. 程式人生 > 其它 >SQLZOO——JOIN Quiz

SQLZOO——JOIN Quiz

技術標籤:SQLZOO學習sqlmysql

目錄

(選擇對應題目直接跳轉即可)

1.You want to find the stadium where player 'Dimitris Salpingidis' scored. Select the JOIN condition to use:

2.You JOIN the tablesgoalandeteamin an SQL statement. Indicate the list of column names that may be used in the SELECT line:

3.Select the code which shows players, their team and the amount of goals they scored against Greece(GRE).

4.Select the result that would be obtained from this code:

5.Select the code which would show the player and their team for those who have scored against Poland(POL) in National Stadium, Warsaw.

6.Select the code which shows the player, their team and the time they scored, for players who have played in Stadion Miejski (Wroclaw) but not against Italy(ITA).

7.Select the result that would be obtained from this code:


小小的進步✌✌✌

1.You want to find the stadium where player 'Dimitris Salpingidis' scored. Select the JOIN condition to use:

2.You JOIN the tablesgoalandeteamin an SQL statement. Indicate the list of column names that may be used in the SELECT line:

3.Select the code which shows players, their team and the amount of goals they scored against Greece(GRE).

---篩選所有與GRE比過賽的隊伍,並且打敗了GRE(teamid != 'GRE')

4.Select the result that would be obtained from this code:

---首先利用DISTINCT去重 排除一些有重複項的選項,然後加上有日期的項,即可選出答案

SELECT DISTINCT teamid, mdate
  FROM goal JOIN game on (matchid=id)
 WHERE mdate = '9 June 2012'

5.Select the code which would show the player and their team for those who have scored against Poland(POL) in National Stadium, Warsaw.

---篩選那些與POL比賽的隊伍(team1 = 'POL' OR team2 = 'POL'),但是打敗了POL的隊伍teamid != 'POL'

6.Select the code which shows the player, their team and the time they scored, for players who have played in Stadion Miejski (Wroclaw) but not against Italy(ITA).

---與上題解題思路一致

7.Select the result that would be obtained from this code:

SELECT teamname, COUNT(*)
  FROM eteam JOIN goal ON teamid = id
 GROUP BY teamname
HAVING COUNT(*) < 3