oracle 10g函数大全--聚合函数
AVG([distinct|all]x)
【功能】统计数据表选中行x列的平均值。 【参数】all表示对所有的值求平均值,distinct只对不同的值求平均值,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,只能为数值型字段 【返回】数字值 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
commit; 执行统计:
select avg(distinct sal),avg(all sal),avg(sal) from table3;
结果: 3333.33 2592.59 2592.59
SUM([distinct|all]x)
【功能】统计数据表选中行x列的合计值。 【参数】all表示对所有的值求合计值,distinct只对不同的值求合计值,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,只能为数值型字段 【返回】数字值 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
commit; 执行统计:
select SUM(distinct sal),SUM(all sal),SUM(sal) from table3;
结果: 6666.66 7777.77 7777.77
STDDEV([distinct|all]x)
【功能】统计数据表选中行x列的标准误差。 【参数】all表示对所有的值求标准误差,distinct只对不同的值求标准误差,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,只能为数值型字段 【返回】数字值 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
commit; 执行统计:
select STDDEV(distinct sal),STDDEV(all sal),STDDEV(sal) from table3;
结果: 3142.69366257674 2565.99863039714 2565.99863039714
VARIANCE([distinct|all]x)
【功能】统计数据表选中行x列的方差。 【参数】all表示对所有的值求方差,distinct只对不同的值求方差,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,只能为数值型字段 【返回】数字值 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
commit; 执行统计:
select VARIANCE(distinct sal),VARIANCE(all sal),VARIANCE(sal) from table3;
结果: 9876523.4568 6584348.9712 6584348.9712
count(*|[distinct|all]x)
【功能】统计数据表选中行x列的合计值。 【参数】
*表示对满足条件的所有行统计,不管其是否重复或有空值(NULL) all表示对所有的值统计,默认为all
distinct只对不同的值统计,
如果有参数distinct或all,需有空格与x(列)隔开,均忽略空值(NULL)。 【参数】x,可为数字、字符、日期型及其它类型的字段 【返回】数字值 count(*)=sum(1) 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
insert into table3 values('',1111.11);
insert into table3 values('zhu',0);
commit; 执行统计:
select count(*),count(xm),count(all xm),count(distinct sal),count(all sal),count(sal),sum(1) from table3;
结果: 5 4 4 3 5 5 5
MAX([distinct|all]x)
【功能】统计数据表选中行x列的最大值。 【参数】all表示对所有的值求最大值,distinct只对不同的值求最大值,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,可为数字、字符或日期型字段 【返回】对应x字段类型 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
insert into table3 values('',1111.11);
insert into table3 values('zhu',0);
commit; 执行统计:
select MAX(distinct sal),MAX(xm) from table3;
结果:5555.55 zhu
MIN([distinct|all]x)
【功能】统计数据表选中行x列的最大值。 【参数】all表示对所有的值求最大值,distinct只对不同的值求最大值,默认为all
如果有参数distinct或all,需有空格与x(列)隔开。 【参数】x,可为数字、字符或日期型字段 【返回】对应x字段类型
注:字符型字段,将忽略空值(NULL) 【示例】
环境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
insert into table3 values('',1111.11);
insert into table3 values('zhu',0);
commit; 执行统计:
select MIN(distinct sal),MIN(xm),MIN(distinct xm),MIN(all xm) from table3;
结果:0 gao gao gao
oracle 10g函数大全--聚合函数的更多相关文章
- 【软件实施面试】MySQL和Oracle联合查询以及聚合函数面试总结
软件实施面试系列文章第二弹,MySQL和Oracle联合查询以及聚合函数的面试总结.放眼望去全是MySQL,就不能来点Oracle吗?之前面过不少公司,也做过不少笔试题,现在已经很少做笔试题了.你肚子 ...
- SQL函数大全(字符串函数).
SQL Server 2005 函数大全 字符串函数 字符串函数 SubString在SQL和C#中不同, 一,select substring('abcde',-1,3) select LEN( ...
- 转载——CLR标量函数、表值函数和聚合函数(UDA)
本节主要介绍使用CLR创建标量函数,表值函数和聚合函数. 所谓标量函数指的就是此函数只返回一个值.表值函数返回值是一个表.聚合函数是在select语句中使用的,用来聚合一个结果集,类似于Sum()或是 ...
- sqlserver的over开窗函数(与排名函数或聚合函数一起使用)
首先初始化表和数据 create table t_student( Id INT, Name varchar(), Score int, ClassId INT ); insert i ...
- sql server 系统常用函数:聚合函数 数学函数 字符串函数 日期和时间函数和自定义函数
一.系统函数 1.聚合函数 聚合函数常用于GROUP BY子句,在SQL Server 2008提供的所有聚合函数中,除了COUNT函数以外,聚合函数都会忽略空值AVG.COUNT.COUNT_BIG ...
- oracle中的常用函数、字符串函数、数值类型函数、日期函数,聚合函数。
一.字符串的常用函数. --一.oracle 字符串常用函数 --1. concat 连接字符串的函数,只能连接[两个]字符串. 字符写在括号中,并用逗号隔开! --2."||"符 ...
- [学习笔记] Oracle字符串函数、日期函数、数值函数、转换函数、聚合函数
函数 单行函数:对一行数据进行操作的函数,如字符串函数.数值函数.转换函数.日期函数等. 聚合函数:同时对多行数据进行操作,如求和函数等. 字符串函数 函数 说明 ASCII(X) 求字符X的ASCI ...
- 数据查询语言DQL 与 内置函数(聚合函数)
数据查询语言DQL 从表中获取符合条件的数据 select select*from表的名字 查询表所有的数据.(select跟from必须一块用 成对出现的) * 表示所有字段,可以换成想要查询的 ...
- 20141031--SQL分组,数学函数,聚合函数
/* 通过代码操作:创建一个数据库,里面有一个学生信息表, 内容包括:学号,姓名,性别,体重,年龄,语数外三门课分数,班级 插入20条数据 执行以下查询操作: 1.查姓王的同学的信息 2.分别查每门课 ...
随机推荐
- 获取高德地图api
先到高德开放平台首页按照关键字搜索地址,获取经纬度坐标: http://lbs.amap.com/console/show/picker 高德由坐标获取地址详细信息: http://restapi.a ...
- linux基础-临时和永久修改ip地址以及通配符相关
一.临时配置网络(ip,网关,dns) 修改临时ip地址: 1.ifconfig查看当前的网卡和ip地址 2.临时修改IP地址:ifconfig ens32 192.168.16.200/24,ifc ...
- [Leetcode Week8]Edit Distance
Edit Distance 题解 原创文章,拒绝转载 题目来源:https://leetcode.com/problems/edit-distance/description/ Description ...
- 使用Tslib在触摸屏上显示汉字【转】
转自:http://www.latelee.org/embedded-linux/use-tslib-to-display-chinese-character.html 终于到了在触摸屏上显示汉字了, ...
- ARM 处理器架构【转】
ARM 处理器架构 转自:http://www.arm.com/zh/products/processors/instruction-set-architectures/index.php ARM 架 ...
- Github上的几个C++开源项目
Github上的几个C++开源项目 http://blog.csdn.net/fyifei0558/article/details/47001677 http://www.zhihu.com/ques ...
- Java中的标记接口(zz)
1.什么是标记接口? Java中把没有定义任何方法和常量的接口称之为标记接口,我们经常使用的比较多的是“”Serializable“”,这个接口也是没有定义人任何方法和常量的. 2.标记接口的作用? ...
- poj 2242(已知三点求外接圆周长)
The Circumference of the Circle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8310 ...
- AC日记——Andryusha and Colored Balloons codeforces 780c
C - Andryusha and Colored Balloons 思路: 水题: 代码: #include <cstdio> #include <cstring> #inc ...
- box-shadow用法简介
语法: <strong>box-shadow:</strong><em><length></em><em><length& ...