当前位置:网站首页>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 .
边栏推荐
- Altium Designer 19.1.18 - 导入板框
- Numpy——1. Creation of array
- Pit record of Chmod 2 options in deepin
- Latex notes
- A complete set of indicators for the 10000 class clean room of electronic semiconductors
- Idea shortcut key
- Global and Chinese market of plastic recycling machines 2022-2028: Research Report on technology, participants, trends, market size and share
- 软件设计师:03-数据库系统
- Mouse click fireworks explosion effect
- editplus
猜你喜欢
MySql——存储引擎
The folder directly enters CMD mode, with the same folder location
What is deep learning?
SQL JOINS
Differences between pycharm and idle and process -- join() in vs Code
MySQL - storage engine
Unforgettable summary of 2021
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
大学生活的自我总结-大一
Build your own random wallpaper API for free
随机推荐
Opendrive record
数字孪生实际应用案例-风机篇
Idea common settings
Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
Numpy——1. Creation of array
The sublime version that XP can run is 3114
Global and Chinese markets of large aperture scintillators 2022-2028: Research Report on technology, participants, trends, market size and share
Apple system optimization
assert_ Usage of param function
Readme, self study record
大学生活的自我总结-大一
Anaconda pyhton multi version switching
Embedded AI intelligent technology liquid particle counter
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
NSIS finds out whether the file exists and sets the installation path
Line test -- data analysis -- FB -- teacher Gao Zhao
Selenium element positioning
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
Apple animation optimization