首页 小组 文章 相册 留言本 用户 搜索 我的社区 在线学堂 商城 购物车 支付钱包

[打卡]段泽欣,聚合函数

2024-04-26 12:16:28
0
110

#count
#作用:

SELECT COUNT(employee_id),COUNT(salary),COUNT(salary*12)
FROM employees;

SELECT COUNT(1)
FROM employees;

SELECT COUNT(4)
FROM employees;

SELECT COUNT(*)
FROM employees;

SELECT COUNT(commission_pct)
from employees;

SELECT commission_pct
from employees
where commission_pct is not NULL;


SELECT 72+35


SELECT AVG(salary),SUM(salary)/COUNT(salary),
AVG(commission_pct),SUM(commission_pct)/COUNT(commission_pct),
SUM(commission_pct)/107
from employees;

SELECT AVG(commission_pct)
from employees;

SELECT AVG(commission_pct)/COUNT(1)
from employees;

SELECT AVG(salary),MAX(salary)
from employees;

SELECT department_id,AVG(salary),MAX(salary)
from employees
GROUP BY department_id;


SELECT job_id,AVG(salary)
from employees
GROUP BY job_id;

SELECT department_id,job_id,AVG(salary)
from employees
GROUP BY department_id
,job_id;


SELECT department_id,job_id,AVG(salary)
from employees
GROUP BY job_id ,department_id;

-- ----------------

SELECT departmen_id,job_id,AVG(salary)
from employees
GROUP BY department_id;

评论
意见反馈