有关世界杯的MySQL-DQL题(新手向)

既然阿根廷夺冠了,也蹭个热度,出几个有关世界杯的MySQL的DQL语句题

内容准备:

create table wcup(
    id tinyint auto_increment primary key,
    year char(4) comment '举办年份',
    hc varchar(10) comment '主办国',
    cham varchar(10) comment '冠军',
    runn varchar(10) comment '亚军',
    thir varchar(10) comment '季军',
    four varchar(10) comment '殿军'
) comment '世界杯名次表';

然后插入数据(数据百度来的,如和真实情况有出入请见谅)

insert into wcup (year,hc,cham,runn,thir,four) values ('1930','乌拉圭','乌拉圭','阿根廷','美国','南斯拉夫');
insert into wcup (year,hc,cham,runn,thir,four) values ('1934','意大利','意大利','捷克斯洛伐克','德国','奥地利');
insert into wcup (year,hc,cham,runn,thir,four) values ('1938','法国','意大利','匈牙利','巴西','瑞典');
insert into wcup (year,hc,cham,runn,thir,four) values ('1950','巴西','乌拉圭','巴西','瑞典','西班牙');
insert into wcup (year,hc,cham,runn,thir,four) values ('1954','瑞士','联邦德国','匈牙利','奥地利','乌拉圭');
insert into wcup (year,hc,cham,runn,thir,four) values ('1958','瑞典','巴西','瑞典','法国','联邦德国');
insert into wcup (year,hc,cham,runn,thir,four) values ('1962','智利','巴西','捷克斯洛伐克','智利','南斯拉夫');
insert into wcup (year,hc,cham,runn,thir,four) values ('1966','英格兰','英格兰','联邦德国','葡萄牙','苏联');
insert into wcup (year,hc,cham,runn,thir,four) values ('1970','墨西哥','巴西','意大利','联邦德国','乌拉圭');
insert into wcup (year,hc,cham,runn,thir,four) values ('1974','西德','联邦德国','荷兰','波兰','巴西');
insert into wcup (year,hc,cham,runn,thir,four) values ('1978','阿根廷','阿根廷','荷兰','巴西','意大利');
insert into wcup (year,hc,cham,runn,thir,four) values ('1982','西班牙','意大利','联邦德国','波兰','法国');
insert into wcup (year,hc,cham,runn,thir,four) values ('1986','墨西哥','阿根廷','联邦德国','法国','比利时');
insert into wcup (year,hc,cham,runn,thir,four) values ('1990','意大利','联邦德国','阿根廷','意大利','英格兰');
insert into wcup (year,hc,cham,runn,thir,four) values ('1994','美国','巴西','意大利','瑞典','保加利亚');
insert into wcup (year,hc,cham,runn,thir,four) values ('1998','法国','法国','巴西','克罗地亚','荷兰');
insert into wcup (year,hc,cham,runn,thir,four) values ('2002','韩日','巴西','德国','土耳其','韩国');
insert into wcup (year,hc,cham,runn,thir,four) values ('2006','德国','意大利','法国','德国','葡萄牙');
insert into wcup (year,hc,cham,runn,thir,four) values ('2010','南非','西班牙','荷兰','德国','乌拉圭');
insert into wcup (year,hc,cham,runn,thir,four) values ('2014','巴西','德国','阿根廷','荷兰','巴西');
insert into wcup (year,hc,cham,runn,thir,four) values ('2018','俄罗斯','法国','克罗地亚','比利时','英格兰');
insert into wcup (year,hc,cham,runn,thir,four) values ('2022','卡塔尔','阿根廷','法国','克罗地亚','摩洛哥');

然后是我想到的几个问题,也可以按你自己的想法补充。反正练手么。

问题:

  1. 多次获得冠军的是哪些国家,各获得了几次?
  2. 多次进入四强的国家是哪些,各是几次,每次名次是第几?
  3. 有没有作为东道主进过四强的国家?有的话是谁,进了几次,每次最好名次是第几?
  4. 有没有东道主夺冠的?有的话是谁,得了几次?
  5. 有没有卫冕冠军?有的话都是谁、卫冕了几次、是哪几届卫冕的?
  6. 哪些国家差一点卫冕成功,具体是哪一年?
  7. 如果将联邦德国或民主德国和德国看作一个国家,以上结果会不会出现变化?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值