SQL查询与数据库设计全解析
1. SQL查询示例
1.1 国家团队比赛赛程查询
假设有以下描述国家团队比赛赛程的关系模式:
- STADIUM(Name, City, Capacity)
- MATCH(StadiumName, Date, Time, Country1, Country2)
- NATIONALITY(Country, Continent, Category)
1.1.1 查询没有欧洲球队参赛的体育场名称
select Name
from Stadium
where Name not in
(select StadiumName
from Match
where (Country1 in
(select Country
from Nationality
where Continent = 'Europe' ))
or
(Country2 in
(select Country
from Nationality
where Continent = 'Europe' )))
操作步骤:
1. 从 Nationality 表中筛选出欧洲国家。
2. 在 Match 表中找出有欧洲国家参赛的比赛所对应的体育场名称。
3. 从 Sta
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



