• SQL ZOO —— 7 JOIN Quiz


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

     game  JOIN goal ON (id=matchid)

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

    matchid, teamid, player, gtime, id, teamname, coach

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

    1. SELECT player, teamid, COUNT(*)
    2. FROM game JOIN goal ON matchid = id
    3. WHERE (team1 = "GRE" OR team2 = "GRE") AND teamid != 'GRE'
    4. GROUP BY player, teamid

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

    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.

    1. SELECT DISTINCT player, teamid
    2. FROM game JOIN goal ON matchid = id
    3. WHERE stadium = 'National Stadium, Warsaw' AND (team1 = 'POL' OR team2 = 'POL') AND 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).

    1. SELECT DISTINCT player, teamid, gtime
    2. FROM game JOIN goal ON matchid = id
    3. WHERE stadium = 'Stadion Miejski (Wroclaw)' AND (( teamid = team2 AND team1 != 'ITA') OR ( teamid = team1 AND team2 != 'ITA'))

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

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

     

  • 相关阅读:
    MobileSAM论文笔记
    算法练习-排序 LeetCode 剑指 Offer 41. 数据流中的中位数
    45.【Java 实现双色球中奖查询系统】
    《算法竞赛·快冲300题》每日一题:“取石子游戏”
    .NET 中 Channel 类简单使用
    139. 单词拆分 dp
    【C++ 学习 ⑳】- 详解二叉搜索树
    CCF CSP 201312-3 最大的矩形 题解
    工作三年,有什么成长?
    Flink
  • 原文地址:https://blog.csdn.net/lvcheng0309/article/details/126583046