Updated on 2024-11-06 GMT+08:00

Analysis Statements - LIMIT

The syntax of a complete analysis statement is as follows:

SELECT [DISTINCT] (* | expression) [AS alias] [, ...]
[GROUP BY expression [, ...] [HAVING predicates]]
[ORDER BY expression [ASC | DESC] [, ...]]
[LIMIT size OFFSET offset]

Where, LIMIT indicates the number of returned data records. The following part describes parameters and examples for the LIMIT syntax.

Specifying the Number of Returned Records

SELECT * LIMIT 1
Table 1 Specifying the number of returned records

account_number

firstname

gender

city

balance

employer

state

lastname

age

1

Amber

M

Brogan

39225

Pyrami

IL

Duke

32

Specifying the Number of Returned Records and Offsets

SELECT * LIMIT 1 OFFSET 1
Table 2 Specifying the number of returned records and offsets

account_number

firstname

gender

city

balance

employer

state

lastname

age

16

Hattie

M

Dante

5686

Netagy

TN

Bond

36