
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to select next row pagination in MySQL?
For this, use the LIMIT concept. Let us create a table −
mysql> create table demo40 −> ( −> id int not null auto_increment primary key, −> name varchar(40) −> ); Query OK, 0 rows affected (1.73 sec)
Insert some records into the table with the help of insert command −
mysql> insert into demo40(name) values('Chris'); Query OK, 1 row affected (0.23 sec) mysql> insert into demo40(name) values('David'); Query OK, 1 row affected (0.12 sec) mysql> insert into demo40(name) values('Mike'); Query OK, 1 row affected (0.10 sec) mysql> insert into demo40(name) values('Sam'); Query OK, 1 row affected (0.19 sec) mysql> insert into demo40(name) values('Carol'); Query OK, 1 row affected (0.12 sec) mysql> insert into demo40(name) values('bob'); Query OK, 1 row affected (0.13 sec)
Display records from the table using select statement −
mysql> select *from demo40;
This will produce the following output −
+----+-------+ | id | name | +----+-------+ | 1 | Chris | | 2 | David | | 3 | Mike | | 4 | Sam | | 5 | Carol | | 6 | bob | +----+-------+ 6 rows in set (0.00 sec)
Following is the query to select next row pagination in MySQL −
mysql> select *from demo40 limit 4,2;
This will produce the following output −
+----+-------+ | id | name | +----+-------+ | 5 | Carol | | 6 | bob | +----+-------+ 2 rows in set (0.00 sec)
- Related Articles
- Select the next row after skipping every 2 rows in MySQL
- How to select last row in MySQL?
- Select a random row in MySQL
- MySQL LIMIT to select a single row
- MySQL query to select records approaching in next 12 hours?
- How to select first and last row record using LIMIT in MySQL?
- How to select row when column must satisfy multiple value in MySQL?
- MySQL query to generate row index (rank) in SELECT statement?
- MySQL query to select one specific row and another random row?\n
- SELECT where row value contains string in MySQL?
- MySQL query to select maximum and minimum salary row?
- How to select first and last data row from a MySQL result?
- MySQL query to select rows except first row in descending order?
- Select random row that exists in a MySQL table?
- How can I select the row with the highest ID in MySQL?

Advertisements