#Grouping function
#1. Query the maximum, minimum, average, and total wages of the company's employees #Salary SELECT SUM(salary),MAX(salary),MIN(salary),AVG(salary),COUNT(salary) FROM employees
deduplication
SELECT
sum( DISTINCT salary ),
sum( salary )
FROM
employees
#Query have several types of wages SELECT count(DISTINCT salary) FROM employees
#Statistics of the number of wages #The SELECT count(salary) FROM employees
total number of rows is the total number of records
SELECT count(*) FROM employees
SELECT count(1) FROM employees
#2. Query the difference between the maximum entry time and the minimum entry time in the employee table (DIFFRENCE)
SELECT
datediff(
max( hiredate ),
min( hiredate )) AS '相差天数'
FROM
employees
#3. Query the number of employees whose department number is 90SELECT count(*) FROM employees WHERE department_id=90