当前位置:网站首页>[untitled] database - limit the number of returned rows
[untitled] database - limit the number of returned rows
2022-04-23 06:25:00 【Wood acridine】
The following is the statement that the database limits the number of returned rows ,SELECT TOP Clause is used to limit the number or percentage of rows returned in the query result set . Because the order of rows stored in the table is unpredictable , therefore SELECT TOP The statement is always the same as ORDER BY Clauses are used together . result , The result set is limited to the first N Number of ordered lines . Here is the SELECT Of the statement TOP Syntax of clause :
In this grammar , SELECT Statements can contain other clauses , Such as : WHERE , JOIN , HAVING and GROUP BY .expression - TOP The keyword is followed by an expression , It specifies the number of rows to return . If you use PERCENT , The expression is evaluated as a floating-point value , Otherwise, convert it to BIGINT value .PERCENT - PERCENT Keyword indicates before the query returns N Percentage of rows , among N Is the result of the expression .WITH TIES - WITH TIES Used to return more rows , Its value matches the last row in the finite result set . Please note that , WITH TIES It may cause more rows to be returned than specified in the expression .
OFFSET and FETCH Clause is ORDER BY Clause options . They are used to limit the number of rows returned by the query . Must be OFFSET and FETCH Clause and ORDER BY Clauses are used together OFFSET and FETCH Clause is better than implementation TOP Clause is more suitable for implementing query paging solution. The following is OFFSET and FETCH Syntax of clause :
In the above grammar ,OFFSET Clause specifies the number of rows to skip before starting to return rows from the query . offset_row_count It can be a constant greater than or equal to zero , Variables or parameters .
FETCH Clause specifies when processing OFFSET Number of rows to return after clause . offset_row_count Can be greater than or equal to 1 The constant , Variable or scalar .
OFFSET Clause is required , and FETCH Clauses are optional . Besides , FIRST and NEXT Synonyms , So they can be used interchangeably .
版权声明
本文为[Wood acridine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210616404858.html
边栏推荐
- A sharp tool to improve work efficiency
- Code neat way to learn
- 自动控制(韩敏版)
- How to use comparative learning to do unsupervised - [cvpr22] training & [eccv20] image translation
- 1. Calculate a + B
- LockSupport. Park and unpark, wait and notify
- Create binary tree
- MySQL table constraints and table design
- Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images
- [leetcode 19] delete the penultimate node of the linked list
猜你喜欢
Framework analysis 1 Introduction to system architecture
Illustrate the significance of hashcode
Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images
St table template
How to use comparative learning to do unsupervised - [cvpr22] training & [eccv20] image translation
String notes
[leetcode 202] happy number
Best practices for MySQL storage time
Fundamentals of digital image processing (Gonzalez) II: gray transformation and spatial filtering
Linear algebra Chapter 1 - determinant
随机推荐
[leetcode 459] duplicate substring
Three ways to create threads
Algèbre linéaire chapitre 1 - déterminants
lambda expressions
电机与拖动(戚金清版)学习整理
图像恢复论文——[RED-Net, NIPS16]Image Restoration Using Very Deep Convolutional Encoder-Decoder Networks wi
A general U-shaped transformer for image restoration
10.Advance Next Round
Example of ticket selling with reentrant lock
線性代數第二章-矩陣及其運算
Fundamentals of SQL: first knowledge of database and SQL - installation and basic introduction - Alibaba cloud Tianchi
Kibana search syntax
PyTorch笔记——实现线性回归完整代码&手动或自动计算梯度代码对比
Pytorch notes - complete code for linear regression & manual or automatic calculation of gradient code comparison
How does MySQL convert stored seconds into dates
Paper on LDCT image reconstruction: edge enhancement based transformer for medical image denoising
On traversal of binary tree
Use Matplotlib. In Jupiter notebook Pyplot server hangs up and crashes
Common sense of thread pool
Protected (members modified by protected are visible to this package and its subclasses)