# 聚合函数涉及到5个单词:数量count()、最大max()、最小min()、平均数avg()、求和sum()
select count(*) '数据总条数' from student where pwd is not null;
select max(age) '年龄最大' from student;
select min(age) '年龄最小' from student;
select avg(age) '平均年龄' from student;
select sum(age) '年龄总和' from student;
# 使用年龄总和计算一下平均数
select sum(age)/(select count (*) '数据总条数' from student) '平均年龄' from student;
2、查询资料
select * from student where introduce like '%人%';
select * from student where pwd is null;
select * from student where age between 10 and 255;
select * from student where
createDate between '2024-02-20 00:00:00' and '2024-02-24 11:00:00';
select * from student where
createDate>'2024-02-20 00:00:00' and createDate<'2024-02-24 11:00:00';
select * from student where userName in ('女娲','蚩尤');
select * from student where userName not in ('女娲','蚩尤');