Home > Database > Mysql Tutorial > body text

How to query data from items 5 to 10 in mysql

王林
Release: 2020-10-19 10:55:49
Original
6145 people have browsed it

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 )
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!