汇总函数 avg平均值,count计数,max最大值,min最小值,sum求和 全部忽略null count(*)函数将所有符合条件的记录都计算在内,通过$amount取值 例:人员总数 selectcount(*) as amount from taihang 例1:各部门中最高工资数额 select id max(wage) as max_wage from taihang groupby id 例2:查询订货量大于库存量的产品名称 select name,库存量,sum(订货量) as sum_订货量 from taihang groupby id, 库存量 having 库存量<sum(订货量) orderby id 例3: selectcount(*) from taihang where 结束时期<='January 1,2005'
例4: selectcount(distinct name) from taihang