1.AVG() 求平均数

select avg(prod_price) as avg_price from products; --返回商品价格的平均值

select avg(prod_price) as avg_price from products where vend_id = 1003; --返回生产商id为1003的商品价格平均值

2.COUNT():确定表中行的数目或者符合特定条件的行的数目

select count(*) as num_cust from customers; --统计customers表中的顾客数
select count(email) as num_cust from customers; --统计具有邮件的用户数目

3.max():返回指定列中的最大值

select max(prod_price) as max_price from products; --返回价格最大值

它能够返回任意列的最大值,如果是文本数据时,会返回最后一行。

4.min():返回指定列的最小值

select min(prod_price) as max_price from products; --返回价格最小值

它能够返回任意列的最小值,如果是文本数据时,会返回最前面的行。

5.sum():返回指定列值的和

select sum(quantity) as items_ordered from orderitems where order_num = 20005;  --返回订单编号为20005所订购的商品总数
select sum(item*quantity) as total_price from orderitems where order_num = 20005;  --返回订单编号为20005所订购的商品总额

最新文章

  1. aspose words 介绍
  2. Canvas旋转元素
  3. Ora-01536:超出了表空间users的空间限量(转)
  4. 安卓第十四天笔记-内容提供者(ContentProvider)
  5. AppCache 离线存储 应用程序缓存 API 及注意事项
  6. php中curl和fsockopen发送远程数据的应用
  7. shell编程之echo命令
  8. c++11之智能指针
  9. 最新模仿ios版微信应用源码
  10. [Hibernate] List 映射例子
  11. Django - - - -视图层之视图函数(views)
  12. win10自带的防火墙Windows Defender
  13. C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 发送通知功能改进改进
  14. HTML5基础标签
  15. MongoDB 之 你得知道MongoDB是个什么鬼 MongoDB - 1
  16. TCP窗口扩大选项
  17. 【1】JVM-内存模型
  18. Java多线程安全问题
  19. ECLIPSE修改xml配置文件TOMCAT不生效的解决
  20. html中如何移除video下载按钮

热门文章

  1. 传智播客ADO.Net项目开发教程具体解释
  2. javaweb_page指令
  3. .Net 与 Javascript 混合编程系列
  4. WebSphere报错指南
  5. cocos2dX 之数据存储
  6. Android之——jni通用工具方法
  7. centos内核编译配置
  8. jQuery通过地址获取经纬度demo
  9. Email-ext plugin
  10. android短信拦截