thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Foundational

LIMIT Clause

A clause that restricts how many rows a query returns; the syntax varies (LIMIT, TOP, FETCH FIRST n ROWS ONLY).

Definition

LIMIT is used by MySQL, PostgreSQL, BigQuery, Snowflake and Databricks; SQL Server uses TOP; Oracle 12c+ and ANSI use FETCH FIRST. Without ORDER BY, which rows are returned is nondeterministic. OFFSET skips rows for paging.

Example

SELECT * FROM Products ORDER BY Price DESC LIMIT 10;

Exam tip

In BigQuery and Snowflake, LIMIT does not necessarily reduce bytes scanned or cost; filters and partition pruning do.

Related terms