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. 09 . Kubernetes之pv、pvc及使用nfs网络存储应用

    PV,PVC概述 PV的全称是: PersistentVolume (持久化卷),是对底层的共享存储的一种抽象,PV由管理员进行创建和配置,它和具体的底层的共享存储技术的实现方式有关,比如Ceph.G ...

  2. java语言基础(二)_IDEA_方法

    IDEA使用 项目结构: 所有代码放置在src文件夹内 新建包:在src文件夹上,右键新建包.包的命名:英文小写.数字.英文句点. 例如:使用公司域名倒写,如cn.itcast.day04.demo0 ...

  3. 大多数人可能都不会使用socketTimeout,看了底层才知道一直都做错了

    前几天一个机房网络抖动,引发了很多对外请求的超时问题,在发生问题排查日志的时候,发现了这么一个现象,httpclient我们的请求超时时间并没有按照我们的设置报超时异常 我们的大概配置如下: Requ ...

  4. nth-child,nth-last-child,after,before,tab-highlight-color,first-child,last-child

    nth-child:定义第几个元素或者是奇数或者是偶数,或者满足某个数字倍数的dom的样式 如 li:nth-child(3n),结果如下,li:nth-child(2)结果如下

  5. P2034 选择数字——线性dp(单调队列优化)

    选择数字 题目描述 给定一行 \(n\) 个非负整数 \(a[1]...a[n]\) .现在你可以选择其中若干个数,但不能有超过 \(k\) 个连续的数字被选择.你的任务是使得选出的数字的和最大. 输 ...

  6. Linux终端音乐播放器cmus攻略: 操作歌单

    目录 1. 安装 2. 操作说明 2.1. *PlayList歌单 2.2. 其他 3. 视图切换 4. 使响应Media/play按键 4.1. 编译安装 cmus是一款开源的终端音乐播放器.它小巧 ...

  7. 2020最新的Spring Boot 分布式锁的具体实现(内附代码)

    前言 面试总是会被问到有没有用过分布式锁.redis 锁,大部分读者平时很少接触到,所以只能很无奈的回答 "没有".本文通过 Spring Boot 整合 redisson 来实现 ...

  8. python 生成器(五):生成器实例(一)创建数据处理管道

    问题 你想以数据管道(类似Unix管道)的方式迭代处理数据. 比如,你有个大量的数据需要处理,但是不能将它们一次性放入内存中. 解决方案 生成器函数是一个实现管道机制的好办法. 为了演示,假定你要处理 ...

  9. python 生成器(一):生成器基础(一)生成器函数

    前言 实现相同功能,但却符合 Python 习惯的方式是,用生成器函数代替SentenceIterator 类.示例 14-5 sentence_gen.py:使用生成器函数实现 Sentence 类 ...

  10. 数据可视化之DAX篇(二十七)半累加度量,在Power BI 中轻松处理

    https://zhuanlan.zhihu.com/p/96823622 ​开始半累加的计算之前,我们先看看什么是累加.半累加以及不可累加数据. 在含有大量行的数据表中,各种数据处理语言,包括DAX ...