How to use the mysql command line to find the minimum and maximum values
This article mainly explains "how to use mysql command line to find minimum and maximum values". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to use mysql command line to find minimum and maximum values" together!
How to use mysql command line to find minimum and maximum values
MySQL actually provides 5 aggregate functions:
MIN(): Minimum number
MAX(): Maximum number
SUM(): sum number
AVG(): Average
COUNT(): Count occurrences
1.mysql Find the minimum value of the column-MIN()
selectMIN(salary)fromemployee_data;+-------------+|MIN(salary)|+-------------+|70000|+-------------+1rowinset(0.00sec)
In the above example, we find the minimum value of the salary column-MIN(salary) from the employee data table (employee_data)
2.mysql Find the maximum value of the column-MAX()
selectMAX(salary)fromemployee_data;+-------------+|MAX(salary)|+-------------+|200000|+-------------+1rowinset(0.00sec)
In the above example, we find the maximum value of the salary column-MAX(salary) from the employee data table (employee_data)
How to create a stored procedure with MYSQL command line
CREATEPROCEDUREp7(INbINTEGER(12))begindeclareaINTEGER(12);seta=5;INSERTINTOtVALUES(a);SELECTs1*aFROMtWHEREb