MAX
(
phone_number
)
AS
phone
,
ROUND
(
SUM
(
score
)
,
2
)
AS
total_score
,
ROUND
(
AVG
(
score
)
,
2
)
AS
average_score
,
COUNT
(
lecturer
)
AS
count
FROM
lecturer_assessment
WHERE
submition_period
=
'202308-2'
GROUP
BY
lecturer
,
college
;
PRIMARY KEY (emp_no,from_date)
INSERT INTO salaries VALUES(10001,85097,‘2001-06-22’,‘2002-06-22’);
INSERT INTO salaries VALUES(1000
文章目录一、基本功能1.
去
重
2.取别名3.聚合函数1)count统计行数2)sum 求
和
3)avg求
平均
4)max/min求最大最小值4.字符串函数1)concat拼接2)+拼接并求
和
5.日期函数6.数值
计算
函数1)round()四舍五入2)floor()向下取整3)rand()随机数
一、基本功能
1.
去
重
DISTINCT
去
重
格式:select DISTINCT 字段1,字段2... from 表名 筛选条件
例如:select distinct name from student;
查询
数据
重复
记录 select * from Test where name in (select name from Test group by name having count(1) >= 2)
数据时间差
计算
平均值
SELECT SUM(tal._time)/count(tal._time) from (
SELECT DATEDIFF(Minute, _repair
阅读目录一、数据
去
重
使用idea创建Maven项目在pom.xml文件添加Hadoop的依赖库,内容如下:编写Dedup.class运行程序二、求
平均
分关于部分详细说明
一、数据
去
重
使相同的数据在最终的输出结果中只保留一份,
使用idea创建Maven项目
在pom.xml文件添加Hadoop的依赖库,内容如下:
<dependencies>
<dep...
1.使用 DISTINCT 关键词
在表中,可能会包含
重复
值。这并不成问题,不过,有时您也许希望仅仅列出不同(distinct)的值。
关键词 DISTINCT 用于返回唯一不同的值。
SELECT DISTINCT 列名称 FROM 表名称
其中的一种使用方式:
select t.a A,count(distinct t.b) B
from table_name t
group by t.a
2.使用row_number() over (partition by col1 order
1、limit 分页关键字
//第一个0代表从哪个位置上获取数据 第二个10表示从那个位置开始取10条数据
select * from t_student limit 0,10;
limit主要用于My
SQL
数据库
进行分页。
//between and 是区间取值
select * from t_student where age between 18 a...
,d.fname_l1
,count(1) over(partition by b.FNAME_L2,d.fname_l1) 数量
from t_gl_voucherentry a1
,t_gl_voucher a
,t_org_company b
,t_bd_period c
,t_pm_user d
where a1.Fbillid=a.fid
and a.fcompanyid=b.fi