SQLZOO(SUM and COUNT)Writeup
2016-04-25 20:38
639 查看
转载自SQLZOO(SUM and COUNT)Writeup
1.
SELECT SUM(population) FROM world
2.
select DISTINCT(continent) from world
3.
select sum(gdp) from world where continent ='Africa'
4.
select count(name) from world where area>1000000
5.
select sum(population) from world where name in ('France','Germany','Spain')
6.
select continent,count(name) from world group by continent
7.
select continent,count(name) from world where population>= 10000000 group by continent
8.
select continent from world group by continent having sum(population)>=100000000
这里不能使用where语句,因为where语句不能与group by 一起使用。
相关文章推荐
- Oracle--单行函数
- mysql基础(三)
- 详解log4j2(下) - Async/MongoDB/Flume Appender 按日志级别区分文件输出
- Redis的快照持久化-Redis学习笔记三
- 查看MySQL每个表占用的空间
- 数据库分库分表(sharding)系列(二) 全局主键生成策略
- Flask迁移数据库
- mysql基础(二)
- mysql服务不能启动,解决方法
- mysql基础(一)
- MySQL中类型比较
- Mysql中limit的用法详解
- Mysql中limit的用法详解
- 用MySQL构建一个工作跟踪流程
- Oracle中insert into select和select into的用法(异常0RA-00905:missing keyword的解决)
- MySql表操作
- MySQL 的 RowNum 实现
- mysql的查询、子查询及连接查询
- 深入浅出MyBatis-Sqlsession
- MySQL查询--使用LEFT JOIN解决同一张表查询