Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report