SELECT COUNT(*)from student where pwd is not null;
select max(age) '最大年龄',min(age) '最小年龄' from student;
SELECT sum(age) '总年龄' from student;
SELECT avg(age) '平均年龄' from student;
#利用sum单独计算一下平均数
SELECT SUM(age)/(SELECT count(*)from student) 'sum计算平均年龄',AVG(age) '平均年龄' from student;
针对上次建的表,使用的语句
count(x)函数为计数
max,min为最大最小值。
sum(x)求和avg(x)求平均数