6 Old JOIN Tutorial-SQLZoo

在这里插入图片描述
1.
Show the athelete (who) and the country name for medal winners in 2000

SELECT who,name
FROM ttms JOIN country ON country = id
WHERE games = 2000;

2.
Show the who and the color of the medal for the medal winners from 'Sweden’

SELECT who,color
FROM ttms JOIN country ON country = id
WHERE name = 'Sweden';

3.
Show the years in which ‘China’ won a ‘gold’ medal

SELECT games
FROM ttms JOIN country ON country = id
WHERE name = 'China' and color = 'gold';

在这里插入图片描述
4.
Show who won medals in the ‘Barcelona’ games

SELECT who
FROM ttws JOIN games ON games = yr
WHERE city = 'Barcelona';

5.
Show which city ‘Jing Chen’ won medals. Show the city and the medal color

SELECT city,color
FROM ttws JOIN games ON games = yr
WHERE who = 'Jing Chen';

6.
Show who won the gold medal and the city

SELECT who,city
FROM ttws JOIN games ON games = yr
WHERE color = 'gold';

在这里插入图片描述
7.
Show the games and color of the medal won by the team that includes 'Yan Sen’

SELECT games,color
FROM ttmd JOIN team ON team = id
WHERE name like '%Yan Sen%';

8.
Show the ‘gold’ medal winners in 2004

SELECT name
FROM ttmd JOIN team ON team = id
WHERE color = 'gold' and games = 2004;

9.
Show the name of each medal winner country 'FRA’

SELECT name
FROM ttmd JOIN team ON team = id
WHERE country = 'FRA';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值