SELECT LIMIT Statement


 

SQLite: SELECT LIMIT Statement

This SQLite tutorial explains how to use the SELECT LIMIT statement in SQLite with syntax and examples.

 

Description:

The SQLite SELECT LIMIT statement is used to retrieve records from one or more tables in SQLite and limit the number of records returned based on a limit value.

 

Syntax:

 

Parameters or Arguments:

expressions

The columns or calculations that you wish to retrieve.

tables

The tables that you wish to retrieve records from. There must be at least one table listed in the FROM clause.

conditions

The conditions that must be met for the records to be selected.

ORDER BY clause

Optional. It is used in the SELECT LIMIT statement so that you can order the results and target those records that you wish to return.

LIMIT

It controls the maximum number of records to retrieve. At most, the number of records specified by number_rows will be returned in the result set. The first row returned by LIMIT will be determined by offset_value.

 

Examples:

The following SQLite statement selects first 3 records/employee from the “Employee” table:

id name position hire_date
100 chiru developer 1/1/2014
101 arunesh manager 1/1/2012
102 naga developer 1/1/2013