当前位置:网站首页>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 .
边栏推荐
- Explanation of parallel search set theory and code implementation
- assert_ Usage of param function
- Summary of STM32 serial port sending and receiving data methods
- How to modify the file path of Jupiter notebook under miniconda
- Calibre garbled
- A series of problems in offline installation of automated test environment (ride)
- Selenium element positioning
- About the problem that MySQL connector net cannot be cleared in MySQL
- Process (P) runs, and idle is different from pycharm
- Play with grpc - go deep into concepts and principles
猜你喜欢
Oracle triggers and packages
Explanation of parallel search set theory and code implementation
611. Number of effective triangles
Self summary of college life - freshman
The mutual realization of C L stack and queue in I
Altium Designer 19.1.18 - 清除测量距离产生的信息
Practical application cases of digital Twins - fans
Set theory of Discrete Mathematics (I)
Numpy——1. Creation of array
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
随机推荐
Package ‘*****‘ has no installation candidate
Basic knowledge of public security -- FB
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
Good websites need to be read carefully
Day01 markdown log entry tips
Leetcode solution - number of islands
Global and Chinese market of plastic recycling machines 2022-2028: Research Report on technology, participants, trends, market size and share
Selenium element positioning
Threads and processes
Use go language to read TXT file and write it into Excel
Idea push project to code cloud
大学生活的自我总结-大一
Idea common settings
NSIS search folder
About the problem that MySQL connector net cannot be cleared in MySQL
1089 Insert or Merge 含测试点5
[neo4j] common operations of neo4j cypher and py2neo
Explain STM32 startup file in detail
Graduation thesis project local deployment practice
The sublime version that XP can run is 3114