The JOIN operation -- SQLZOO
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 player
, teamid
, coach
, gtime
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的更多相关文章
- More JOIN operations -- SQLZOO
The JOIN operation 注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道 01.List the films where the y ...
- mysql练习----The JOIN operation
game id mdate stadium team1 team2 1001 8 June 2012 National Stadium, Warsaw POL GRE 1002 8 June 2012 ...
- SQLZOO 习题
https://sqlzoo.net 8. 美國.印度和中國(USA, India, China)是人口又大,同時面積又大的國家.排除這些國家. 顯示以人口或面積為大國的國家,但不能同時兩者.顯示國家 ...
- Java Concurrency - Fork/Join Framework
Normally, when you implement a simple, concurrent Java application, you implement some Runnable obje ...
- Spark RDD/Core 编程 API入门系列 之rdd案例(map、filter、flatMap、groupByKey、reduceByKey、join、cogroupy等)(四)
声明: 大数据中,最重要的算子操作是:join !!! 典型的transformation和action val nums = sc.parallelize(1 to 10) //根据集合创建RDD ...
- Join Algorithm
Join(SQL) An SQL join clause combines columns from one or more tables in a relational database. It c ...
- 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 ...
- 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. ...
- 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 ...
随机推荐
- Centos 6.4 安装/卸载 Adobe Reader 9(.bin .tar.bz2 rpm 包)
一.To install Adobe Reader 9.1 using a tarball installer 1. Open a terminal window. 2. Change directo ...
- Java NIO之Buffer的使用
目录 Buffer简介 Buffer的核心属性 Buffer的创建与使用(ByteBuffer为例) 总结 参考资料 Buffer简介 缓冲区(Buffer):本质上是一个数组,用于临时保存.写入以及 ...
- 12 . Kubernetes之Statefulset 和 Operator
Statefulset简介 k8s权威指南这样介绍的 "在Kubernetes系统中,Pod的管理对象RC.Deployment.DaemonSet和Job都面向无状态的服务.但现实中有很多 ...
- 常用API - 包装类、System类
包装类 概述 Java提供了两个类型系统,基本类型与引用类型,使用基本类型在于效率. 然而很多情况,会创建对象使用,因为对象可以做更多的功能. 如果想要我们的基本类型像对象一样操作,就可以使用基本类型 ...
- Mysql查询语句执行过程
Mysql查询语句执行过程 Mysql分为server层和存储引擎两部分,或许可以再加一层连接层 连接层(器) Mysql使用的是典型的C/S架构.连接器通过典型的TCP握手完成连接. 需要注 ...
- 6.26模拟赛(1)总结(T1:信息传递;T2:传染病控制;T3:排列;T4:最大数)
16:33:56 2020-06-26 当然可以先看一下成绩: 非常显然的成绩不能算有多好,当然其实这也可能是假期水课的报应 (额) 但是比我集训前想象的要好一点(集训时想象的是排名前30就可以,嗯 ...
- sql语句replace函数的使用
SQL中的替换函数replace()使用 语法 REPLACE ( string_expression , string_pattern , string_replacement ) 参数 strin ...
- 数组中出现次数超过一半的数字(剑指offer-28)
题目描述 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字.例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2. ...
- 二叉搜索树的后序遍历序列(剑指offer-23)
题目描述 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则输出Yes,否则输出No.假设输入的数组的任意两个数字都互不相同. 题目解析 采用分治法的思想,找到根结点.左子树的序 ...
- Linux系统安装JDK8
一.卸载现用的JDK 1.查看Linux自带的JDK是否已安装 查看是否安装openjdk,java -version (yum安装的 一般都是 OpenJDK 命令:yum install ...