| Server IP : 104.21.13.164 / Your IP : 216.73.216.72 Web Server : Apache System : Linux gator4057.hostgator.com 5.14.0-687.17.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jun 22 07:21:26 EDT 2026 x86_64 User : badawi ( 1130) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/firebird/sql.extensions/ |
Upload File : |
-----------
ROWS clause
-----------
Function:
Limits the number of rows retrieved from a select expression. For the
top-level select statement, it would mean a number of rows sent to the host
program.
Author:
Dmitry Yemanov <[email protected]>
Syntax rules:
SELECT ... [ORDER BY <expr_list>] ROWS <expr1> [TO <expr2>]
Scope:
DSQL, PSQL
Example(s):
1. SELECT * FROM T1
UNION ALL
SELECT * FROM T2
ORDER BY COL
ROWS 10 TO 100
2. SELECT COL1, COL2, ( SELECT COL3 FROM T3 ORDER BY COL4 DESC ROWS 1 )
FROM T4
3. DELETE FROM T5
ORDER BY COL5
ROWS 1
Note(s):
1. ROWS is a more understandable alternative to the FIRST/SKIP clauses with
some extra benefits. It can be used in unions and all kind of subqueries.
It is also available in the UPDATE/DELETE statements.
2. When <expr2> is omitted, then ROWS <expr1> is a semantical equivalent for
FIRST <expr1>. When both <expr1> and <expr2> are used, then ROWS <expr1>
TO <expr2> means:
FIRST (<expr2> - <expr1> + 1) SKIP (<expr1> - 1). Note that there's no
semantic equivalent for a SKIP clause used without a FIRST clause.
3. The ROWS-clause is not defined in the SQL standard. For SELECT, consider
the alternative OFFSET and FETCH clauses defined in the SQL standard.