# 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 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 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 department_id,job_id,AVG(salary)
FROM employees
GROUP BY department_id;