- SQL查询表一email 里面的重复的电子邮箱
- SQL查询表二World中所有大国家的名称、人口和面积
表一:查找重复的电子邮箱
Id | |
---|---|
1 | a@b.com |
2 | c@d.com |
3 | a@b.com |
编写一个 SQL 查询,查找 email 表中所有重复的电子邮箱
select Email from email where email group by Email HAVING count(Email)>1
表二:查找大国
name | continent | area | population | gdp |
---|---|---|---|---|
Afghanistan | Asia | 652230 | 25500100 | 20343000 |
Albania | Europe | 28748 | 2831741 | 12960000 |
Algeria | Africa | 2381741 | 37100000 | 188681000 |
Andorra | Europe | 468 | 78115 | 3712000 |
Angola | Africa | 1246700 | 20609294 | 100990000 |
如果一个国家的面积超过 300 万平方公里,或者(人口超过 2500 万并且 gdp 超过 2000 万),那么这个国家就是大国家。
编写一个 SQL 查询,输出表中所有大国家的名称、人口和面积
select name,population,area from World where area > 3000000 and population >25000000 and gdp>20000000