当前位置:网站首页>Database learning notes II
Database learning notes II
2022-06-26 07:53:00 【sunshine_ 0224】
Query statement expansion
limit Use (mysql Medium limit Be similar to sqlserver Medium top)
Use case table Student

The first one is :SELECT * FROM table LIMIT [offset,] rows
There are two parameters , First offset , from 0 At the beginning , The second parameter represents the number of rows .
select * from Student order by Stu_num asc limit 1,2
The result should be the red framed part

The second kind :SELECT * FROM table LIMIT rows OFFSET offset
select * from Student order by Stu_num asc limit 2 offset 1

group by And aggregate functions
1. In the use of GROUP BY When clause ,Select All columns in the list must be aggregate columns (SUM,MIN/MAX,AVG etc. ) or GROUP BY Columns included in clause . Again , If in SELECT Aggregate columns are used in the list ,SELECT The list must include only aggregate columns , Otherwise there must be one GROUP BY Clause .
2. Aggregate functions . Aggregate functions are used for GROUP BY Words and expressions , Used to aggregate grouped data . The aggregate function is in and GROUP BY Clause shows its powerful function . However, the use of aggregate functions is not limited to grouping queries ; If an aggregate function is used in the query statement , and No use GROUP BY Clause , The aggregate function is used to aggregate the entire result set ( matching WHERE Clause ). When not used GROUP BY When clause , stay SELECT Some aggregate functions in the list can only be used with other aggregate functions , That is, the aggregate function must use GROUP BY Clause can be used in SELECT Match the list with the list . for example , Don't use GROUP BY Clause ,SELECT In the list AVG And the only SUM Corresponding , But it cannot correspond to a specific column .
Be careful : in application , Aggregate functions are often combined with grouping functions group by Use a combination of
Common aggregate functions
边栏推荐
- [issue 22] sheen cloud platform one side & two sides
- Jemter stress test - Basic request - [teaching]
- Area of Blue Bridge Cup 2 circle
- Detailed explanation and code implementation of soft voting and hard voting mechanism in integrated learning
- Redis (4) -- Talking about integer set
- What are the characteristics of digital factory in construction industry
- Solve psycopg2 NotSupportedError: PQconninfo not available in libpq < 9.3
- What is the five levels of cultivation of MES management system
- 信息学奥赛一本通 1355:字符串匹配问题(strs)
- Solution to the problem of multi application routing using thinkphp6.0
猜你喜欢

Web technology sharing | webrtc recording video stream

C#/. Net phase VI 01C Foundation_ 02:vs2019 basic operations, excluding code files, smart tips, data types, differences between float and double, and differences between string and string

Chapter II (summary)

Color code

Uniapp wechat withdrawal (packaged as app)

QT之一个UI里边多界面切换

Arrangement and insertion structure

Webrtc has become the official standard of W3C and IETF, and mobile terminal development

In interface testing, several methods to verify the success of deleting interfaces

B站增量数据湖探索与实践
随机推荐
arduino——ATtiny85 SSD1306 + DHT
Is it safe for individuals to buy stocks with compass software? How to buy stocks
Request&Response
Redis (5) -- Talking about compressed list
B站增量数据湖探索与实践
Is it legal to open an account for compass stock trading software? Is it safe?
Multi interface switching in one UI of QT
Hand drawn style chart library chart Implementation principle of xkcd
Leetcode topic [array] -11- containers with the most rainwater
信息学奥赛一本通 1354:括弧匹配检验
Xiaosha's counting (bit operation, Combinatorial Mathematics) - Niuke
Junit
OSPF design principles, commands take H3C as an example
The difference between setstoragesync and setstorage
Here is the command to display the disk space usage. Go ahead and pay attention to more wonderful things!
Area of Blue Bridge Cup 2 circle
Automatic backup of MySQL database in the early morning with Linux
Project management learning
Getdrawingcache of view is empty. Solution: interview questions for Android audio and video development
ECE 9203/9023 analysis