Example 3: LIMIT Clause Along with OFFSET Clause
In this example, we are going to use limit clause along with the offset clause. We are going to discuss two case related to it.
CASE 1: Displaying 5 Records Skipping the First 2 Rows
Query:
SELECT *
From w3wiki
LIMIT 5 OFFSET 2;
Output:
Explanation: In this case, we have specified in query to display only five records. With the help of offset clause we can skip the first 2 rows. As we can observe, id 102, 103 are not displayed as they are first 2 records and succeeding 5 records are displayed.
CASE 2: Displaying Records From 4 to 7
Query:
SELECT *
From w3wiki
LIMIT 4 OFFSET 3;
Output:
Explanation: We have specified in the query to skip first 3 records. We have also set the limit up to 4 records. Therefore as a result we will get all the records which lie between 4-7 (including 4-7).
How To Limit The Number Of Rows Returned In SQLite
SQLite is a lightweight and self-contained relational database management system in short RDBMS. It supports standard SQL syntax. It is designed as a simple and easy-to-use database. It requires very less configurations which makes it very easy for developers to integrate it into any application. In this article, we are going to explore the topic “how to limit the number of rows returned in SQLite“. We are going to explore its basic concepts with some clear and concise examples.
Contact Us