The JOIN operation

注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道

01.Modify it to show the matchid and player name for all goals scored by Germany. To identify German players, check for: teamid = 'GER

译文:修改后显示德国队所有进球的比赛id和球员名字。要确定德国球员,请检查:teamid = 'GER'

SELECT matchid, player FROM goal
WHERE teamid = 'GER';

02.Show id, stadium, team1, team2 for just game 1012

  SELECT id,stadium,team1,team2
  FROM game
  WHERE id = 1012;

03.Modify it to show the player, teamid, stadium and mdate for every German goal.

译文:修改它,显示球员,teamid,体育场和mdate为每个德国进球。

SELECT player, teamid, stadium, mdate FROM game JOIN goal ON (id=matchid) WHERE teamid = 'GER';

04.Show the team1, team2 and player for every goal scored by a player called Mario player LIKE 'Mario%'

译文:展示一个叫马里奥的球员(比如“马里奥%”)每进一球的团队1、团队2和球员。

SELECT team1, team2, player FROM game JOIN goal ON (id=matchid) WHERE player LIKE 'Mario%';

05.Show playerteamidcoachgtime for all goals scored in the first 10 minutes gtime<=10

译文:显示球员,teamid,教练,在前10分钟内所有的进球gtime<=10

SELECT player, teamid,coach, gtime FROM goal JOIN eteam on teamid=id WHERE gtime<=10;

06.List the dates of the matches and the name of the team in which 'Fernando Santos' was the team1 coach.

译文:请列出比赛日期和由“费尔南多·桑托斯”担任球队教练的球队名称。

SELECT mdate, teamname FROM game JOIN eteam on (team1=eteam.id) WHERE coach = 'Fernando Santos';

07.List the player for every goal scored in a game where the stadium was 'National Stadium, Warsaw'

译文:列出球场为“华沙国家体育场”的比赛中每进一球的球员名单

SELECT player FROM game JOIN goal ON (id=matchid) WHERE stadium = 'National Stadium, Warsaw'

08.Instead show the name of all players who scored a goal against Germany.

译文:显示所有在对德国队的比赛中进球的球员的名字。

SELECT DISTINCT player FROM game JOIN goal ON matchid = id WHERE (team1='GER' AND teamid != 'GER') OR (team2='GER' AND teamid != 'GER');

09.Show teamname and the total number of goals scored.

译文:显示球队名称和进球总数

SELECT teamname, COUNT(player) FROM eteam JOIN goal ON id=teamid GROUP BY teamname;

10.Show the stadium and the number of goals scored in each stadium.

译文:显示球场和每个球场的进球数

SELECT stadium, COUNT(player) FROM game JOIN goal ON id=matchid GROUP BY stadium;

11.For every match involving 'POL', show the matchid, date and the number of goals scored.

译文:对于每一场涉及“POL”的比赛,显示比赛id、日期和进球次数。

SELECT DISTINCT matchid, mdate, COUNT(teamid) FROM game JOIN goal ON matchid = id WHERE team1 = 'POL' OR team2 = 'POL' group by matchid, mdate;

12.For every match where 'GER' scored, show matchid, match date and the number of goals scored by 'GER'

译文:对于每一场“GER”进球的比赛,显示matchid、比赛日期和“GER”进球的次数

SELECT DISTINCT matchid, mdate, COUNT(teamid) FROM game JOIN goal ON matchid = id WHERE ( team1 = 'GER' AND teamid = 'GER') OR (team2 = 'GER' AND teamid = 'GER') group by matchid, mdate;

13.Sort your result by mdate, matchid, team1 and team2.

译文:根据mdate, matchid, team1和team2对你的结果排序。

# 写不出来

练习网址:https://sqlzoo.net/wiki/The_JOIN_operation

——————————————————————————————————————————————————————————————————————————————————————————————————————————

The JOIN operation -- SQLZOO的更多相关文章

  1. More JOIN operations -- SQLZOO

    The JOIN operation 注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道 01.List the films where the y ...

  2. mysql练习----The JOIN operation

    game id mdate stadium team1 team2 1001 8 June 2012 National Stadium, Warsaw POL GRE 1002 8 June 2012 ...

  3. SQLZOO 习题

    https://sqlzoo.net 8. 美國.印度和中國(USA, India, China)是人口又大,同時面積又大的國家.排除這些國家. 顯示以人口或面積為大國的國家,但不能同時兩者.顯示國家 ...

  4. Java Concurrency - Fork/Join Framework

    Normally, when you implement a simple, concurrent Java application, you implement some Runnable obje ...

  5. Spark RDD/Core 编程 API入门系列 之rdd案例(map、filter、flatMap、groupByKey、reduceByKey、join、cogroupy等)(四)

    声明: 大数据中,最重要的算子操作是:join  !!! 典型的transformation和action val nums = sc.parallelize(1 to 10) //根据集合创建RDD ...

  6. Join Algorithm

    Join(SQL) An SQL join clause combines columns from one or more tables in a relational database. It c ...

  7. Chapter 4 Left Outer Join in MapReduce

    4.1 Introdution Consider a company such as Amazon, which has over 200 millions of users and possibly ...

  8. Map Reduce Application(Join)

    We are going to explain how join works in MR , we will focus on reduce side join and map side join. ...

  9. JavaPersistenceWithHibernate第二版笔记-第六章-Mapping inheritance-006Mixing inheritance strategies(@SecondaryTable、@PrimaryKeyJoinColumn、<join fetch="select">)

    一.结构 For example, you can map a class hierarchy to a single table, but, for a particular subclass, s ...

随机推荐

  1. CentOS 的数字命令级别

    1    user commands 2    system calls 3    library functions 4    special  files 5     file formats 6 ...

  2. 与跨域相关的 jsonp 劫持与 CORS 配置错误

    参考文章: CORS(跨域资源共享)错误配置漏洞的高级利用 JSONP劫持CORS跨源资源共享漏洞 JSONP绕过CSRF防护token 读取型CSRF-需要交互的内容劫持 跨域资源共享 CORS 详 ...

  3. The Meaningless Game,算是思维吧。

    题目直接链接 题意: 某游戏规则:每次选定数字k(正整数),两人初始分数为1,获胜者分数乘k2,失败者分数成k,给你两个数字,判断是否可能是本游戏的两人的得分. 分析: 为啥题意我不写判断两个数可不可 ...

  4. POJ1017贪心

    题意:小P开了一家淘宝店铺,店铺里所有的商品高度都为h,但长和宽分别为1*1,2*2,3*3,4*4,5*5,6*6六种规格.这一天来了一个大客户,他订购了很多物品.所以小P需要将东西都邮寄给他,但是 ...

  5. locust接口压测

    前言: locust是完全基于python,是一个简单易用的分布式负载测试工具 Locust特性 使用Python编写模拟用户行为的代码,无需繁琐的配置 分布式可扩展,能够支持上百万用户 自带Web界 ...

  6. JavaScript图形实例:随机SierPinski三角形

    在“JavaScript图形实例:SierPinski三角形”中,我们介绍了SierPinski三角形的基本绘制方法,在“JavaScript图形实例:迭代函数系统生成图形”一文中,介绍了采用IFS方 ...

  7. day29 作业

    1.引入属性访问控制+property 2.引入继承与派生的概念来减少代码冗余 注意:要满足什么"是"什么的关系,不满足"是"的关系不要去继承 import u ...

  8. Navigation Nightmare POJ - 1984

    Navigation Nightmare Farmer John's pastoral neighborhood has N farms (2 <= N <= 40,000), usual ...

  9. 外部应用复制 表格 到word中 设置表格自适应

    word 批量设置表格宽度自适应 描述 : 我们经常从 外部 如 excel,html 等其他文件 中复制的表格到word 文档 经常会出现在 word 中显示不全的问题 主要是源格式的表格 宽度比 ...

  10. cmder安装(window下好用的终端)

    cmder下载地址:cmder官网 安装步骤: 下载cmder(cmder官网)并解压缩 配置环境变量 先配置CMDER_HOME(cmder.exe所在目录) 配置path:%CMDER_HOME% ...