Home  >  Article  >  Database  >  How to query data from items 5 to 10 in mysql

How to query data from items 5 to 10 in mysql

王林
王林Original
2020-10-16 15:12:406161browse

Mysql method to query the data from items 5 to 10: execute the [select top 10 * from TB1 where Id not in (select top 5 Id from TB1)] statement to query.

How to query data from items 5 to 10 in mysql

Query the fifth to tenth data in the database, there are two situations:

(Recommended tutorial: mysql Video tutorial)

1. The IDs are connected. Of course, this situation is easier to check. Just SELECT directly. Just select the ID greater than 5 and less than 10.

This situation is relatively rare.

2. IDs are not connected. If you want to get the fifth to tenth data, you have to start with SQL query SELECT

select top 10 * from TB1 where Id not in (select top 5 Id from TB1 )

Among them, 10 means: the number of queries, and 5 means Which item should I start checking from?

Related recommendations: mysql tutorial

The above is the detailed content of How to query data from items 5 to 10 in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn