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

[打卡]张博研——count和group by的用法

2024-04-26 12:13:26
0
112

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

SELECT COUNT(1) FROM employees;
SELECT COUNT(*) FROM employees;
SELECT COUNT(commission_pct)
FROM employees;
SELECT commission_pct from employees where commission_pct
is not NULL;
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 SUM(commission_pct)/COUNT(1)
FROM employees;

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

SELECT 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;

评论
意见反馈