Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use the mysql command line to find the minimum and maximum values

Shulou Source: shulou.com Published: 2022-05-31 17:54:24 09月26日 Update

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

Tags: Maximum minimum command maximum statements procedures storage learning examples content employees that is data datasheets salaries things between functions semicolons delimiters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn OPPO Reno Shulou Technology Redmi