Book Contents

Book Index

Next Topic

Home

LIMIT Clause

Specifies the maximum number of result set rows to return.

Syntax

LIMIT { rows | ALL }

Semantics

 

rows

specifies the maximum number of rows to return

ALL

returns all rows (same as omitting LIMIT)

Notes

 

C1

C2

1

2

2

1

1

1

2

2

 

SELECT *

FROM T

ORDER BY C1

LIMIT 3;

The last row of the result set in this example is undefined in any SQL database but may be consistent enough in other databases for poorly-coded application programs or reports to get the same result set every time. In Vertica however, the distributed nature of the database makes the last row unpredictable, which may cause poorly-coded application programs or reports to get different a result set each time.