当前位置:网站首页>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 .
边栏推荐
- CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
- Build your own random wallpaper API for free
- Line test -- data analysis -- FB -- teacher Gao Zhao
- Altium Designer 19.1.18 - 隐藏某一个网络的飞线
- What is Bezier curve? How to draw third-order Bezier curve with canvas?
- 611. Number of effective triangles
- Close of office 365 reading
- How to deal with excessive memory occupation of idea and Google browser
- Rename directory in C [closed] - renaming a directory in C [closed]
- STM32 learning method
猜你喜欢
Play with grpc - go deep into concepts and principles
Extended application of single chip microcomputer-06 independent key
Leetcode solution - number of islands
大学生活的自我总结-大一
Unforgettable summary of 2021
软件设计师:03-数据库系统
Logistic regression: the most basic neural network
What is Bezier curve? How to draw third-order Bezier curve with canvas?
数字孪生实际应用案例-风机篇
Shadowless cloud desktop - online computer
随机推荐
What is Bezier curve? How to draw third-order Bezier curve with canvas?
Process (P) runs, and idle is different from pycharm
Explain STM32 startup file in detail
From then on, I understand convolutional neural network (CNN)
Differences between pycharm and idle and process -- join() in vs Code
Apple script
Query the table name used by kettle in Oracle
Close of office 365 reading
Distinction between heap and stack
Numpy——1.數組的創建
公安专业知识--哔哩桐老师
PIL's image tool image reduction and splicing.
I implement queue with C I
Apple terminal skills
Basic series of SHEL script (III) for while loop
P3D gauge size problem
Global and Chinese market of blackbody calibration source 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of large aperture scintillators 2022-2028: Research Report on technology, participants, trends, market size and share
Apple system shortcut key usage
assert_ Usage of param function