当前位置:网站首页>Count and sort the occurrence times of specific fields through SQL statements
Count and sort the occurrence times of specific fields through SQL statements
2022-07-05 07:45:00 【qq_ twenty-nine million five hundred and sixty-six thousand six】
select log_ip, count(*) as number from tp_admin_log group by log_ip order by number desc
The function realized is statistics tp_admin_log table log_ip The number of times each value of the field appears and is sorted in descending order .
ps:
It should be noted that ,group by Functions are generally related to aggregate functions , such as count() Functions together
Common aggregate functions are :COUNT(),SUM(),AVG(),MIN(),MAX().
COUNT(), Its main function is to return the number of rows in each group , Will also return yes NULL Columns of values , Can be used for numeric and character columns .
SUM(), It is mainly used to return the sum of all expressions , Ignore NULL value , For numeric columns only .
AVG(), Returns the average of all expressions , Only for numeric columns and automatically ignored NULL value .
MIN(), Returns the minimum value in the expression , Ignore NULL value , Can be used for digital 、 Character and date time Columns .
MAX(), Returns the maximum value in the expression , Ignore NULL value , Can be used for digital 、 Character and date time Columns .
边栏推荐
- Global and Chinese markets for waste treatment air switches 2022-2028: Research Report on technology, participants, trends, market size and share
- Numpy——1.數組的創建
- Charles- unable to grab bags and surf the Internet
- Basic series of SHEL script (II) syntax + operation + judgment
- Altium Designer 19.1.18 - 导入板框
- Basic series of SHEL script (I) variables
- msys2
- 软件设计师:03-数据库系统
- Global and Chinese markets of nano biosensors 2022-2028: Research Report on technology, participants, trends, market size and share
- Efficiency difference: the add method used by the set directly and the add method used by the set after judgment
猜你喜欢

Set theory of Discrete Mathematics (I)

Altium Designer 19.1.18 - 隐藏某一个网络的飞线

Altium Designer 19.1.18 - 更改铺铜的透明度

What is deep learning?

I implement queue with C I

Extended application of single chip microcomputer-06 independent key

行测--资料分析--fb--高照老师

Embedded AI intelligent technology liquid particle counter

Graduation thesis project local deployment practice

How to deal with excessive memory occupation of idea and Google browser
随机推荐
String alignment method, self use, synthesis, newrlcjust
Global and Chinese markets for medical oxygen machines 2022-2028: Research Report on technology, participants, trends, market size and share
Eclipse project recompile, clear cache
A series of problems in offline installation of automated test environment (ride)
Process (P) runs, and idle is different from pycharm
[untitled]
[idea] common shortcut keys
I implement queue with C I
Good websites need to be read carefully
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
Day08 ternary operator extension operator character connector symbol priority
MySql——存储引擎
Detailed explanation of C language pointer
Package ‘*****‘ has no installation candidate
Openxlsx field reading problem
Deepin, help ('command ') output saved to file
Latex notes
From then on, I understand convolutional neural network (CNN)
大学生活的自我总结-大一
How to modify the file path of Jupiter notebook under miniconda