聚合函数查询
聚合函数会涉及到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.具体内容
insert into student values(0,'2024-02-25 10:10:10','盘古',
'123456','15612345678',255,'神','开天辟地第一人。');
insert into student values(0,'2024-02-25 10:10:10','女娲',
'123456','15612345678',200,'女','多次造人最终成功。');
insert into student values(0,'2024-02-25 10:10:10','伏羲',
'123456','15612345678',215,'神','先天八卦');
insert into student values(0,'2024-02-25 10:10:10','神农',
'123456','15612345678',155,'男','尝百草,死与断肠草下。');
insert into student values(0,'2024-02-25 10:10:10','嫘祖',
'123456','15612345678',115,'神','教会百姓养蚕织布');
insert into student values(0,'2024-02-25 10:10:10','蚩尤',
'123456','15612345678',155,'男','锻造大神,坐下食铁巨兽。');
insert into student (userName,age,introduce) values('仓颉',125,'中国象形文字');
select*from student where introduce like '%人%'