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 ...
随机推荐
- BAT 非右键方式以管理员身份运行批处理
@echo off & PUSHD %~dp0 & TITLE Run The BAT File As An Administrator mode con lines=4 cols=6 ...
- return zero,or ,return non-zero
it may return a value to its caller, which is in effect the environment in which the program was exe ...
- 核心知识点:python入门
目录 一.python入门day1-day24 day01-03 编程语言 day04 变量 day05 垃圾回收机制(GC机制) 1 引用计数 2 标记清除 3 分代回收 day05 程序交互与基本 ...
- day41 几个琐碎知识点
目录 一.死锁与递归锁(了解) 1 死锁 2 递归锁 二.信息量 三.Event事件 四.三种优先级数据操作 1 队列 2 堆栈 3 自定义优先级 五.进程池和线程池 基本使用 六.协程 七.geve ...
- day22 作业
1 统计文件夹大小 def get_filesize(file_path): count = 0 res=None files_sum = os.listdir(file_path) for file ...
- 关于小白一天摆弄Axure产品原型的心得
因为项目所需,被迫快速设计产品原型,制作app使用视频,这里简单分享一些一个小白第一次触碰产品原型设计的一些心得: 原型设计工具的选用 我这里针对的是贫穷学生党,分享的是自己尝试的几款.有钱大佬自行绕 ...
- SpringBoot入门详细教程
一.SpringBoot入门 1.SpringBoot简介 SpringBoot是整个Spring技术栈的整合,来简化Spring应用开发,约定大于配置,去繁从简,just run 就能创建一 个独立 ...
- 数据可视化之powerBI基础(九)Power BI中的“新表”,你会用吗?
https://zhuanlan.zhihu.com/p/64413703 通常情况下,在PowerBI进行分析的各种数据表都是从外部的各种数据源导入进来的,但并不总是如此,某些情况下在PowerBI ...
- Mysql UDF提权方法
0x01 UDF UDF(user defined function)用户自定义函数,是mysql的一个拓展接口.用户可以通过自定义函数实现在mysql中无法方便实现的功能,其添加的新函数都可以在sq ...
- 区分C语言中的指针函数和函数指针
1.指针函数: 类型说明符 *函数名(形参表) { .......... /*函数体*/ .......... /*函数体*/ } 其中函数名之前加了"*"号表明,这是一 ...