当前位置:网站首页>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
边栏推荐
- 项目管理学习
- Pic 10B parsing
- [North Asia data recovery] a server data recovery method in which the partitions in the RAID5 array are formatted due to the misoperation of the NTFS file system
- Children play games (greed, prefix and) - Niuke winter vacation training camp
- The 9th zero code training camp is officially open for registration! (Beijing, Shanghai, Guangzhou and Shenzhen)
- D do not assign references to non domain parameters
- Livevideostackcon | evolution of streaming media distribution for online education business
- 指南针炒股软件开户是合法的吗?安全吗
- Jemter 压力测试 -可视化工具-【使用篇】
- Technology sharing | mysql:caching_ sha2_ Password quick Q & A
猜你喜欢

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

What if the service in Nacos cannot be deleted?

Yyds dry inventory kubernetes easy service discovery and load balancing (11)

Google Earth engine (GEE) 01- the prompt shortcut ctrl+space cannot be used

Two models of OSPF planning: double tower Raider and dog tooth crisscross

JS Date object

我想造SQL数据(存储结构)

Real machine debugging of uniapp custom base

The first multi platform webcast of 2021ccf award ceremony pays tribute to the winners! CCF outstanding engineer

Chapter 3 (data types and expressions)
随机推荐
Yyds dry inventory executor package (executor function)
ReW_ p
Web technology sharing | webrtc recording video stream
项目管理学习
Redis(4)----浅谈整数集合
Getdrawingcache of view is empty. Solution: interview questions for Android audio and video development
Bluebridge cup 1 introduction training Fibonacci series
Listview control
Google Earth engine (GEE) 02 basic knowledge and learning resources
Which securities company has the lowest Commission for opening a mobile account? Is it safe to open an account online?
Chapter 3 (data types and expressions)
[UVM basics] understanding of sequence and sequencer
有序排列
Esp32-c3 introductory tutorial WiFi part ⑥ - WIFI intelligent distribution network based on serial port
Informatics Orsay all in one 1354: bracket matching test
Power apps application practice | easily develop employee leave attendance management applet with power apps
[UVM foundation] UVM_ Driver member variable req definition
[UVM practice] Chapter 3: UVM Fundamentals (3) field automation mechanism
Okhttp3 source code explanation (IV) cache strategy, disadvantages of Android mixed development
Junit