Understanding of limit and offset in sqlite3 Database

Source: Internet
Author: User

Reposted from: danshiming blog; http://blog.163.com/danshiming@126/blog/static/109412748200921163550296/


Select * From trom_daTa where device_id = 12 order by time_stamp DESC limit 1 offset 0

In an SQL statement, limit 1 offset 0 indicates that one record is obtained based on 0th records (including 0th records) in the query results, the obtained records are 0th records, that is, the maximum time for device_id = 12 and time_stamp in this table.

 

Limit: number of records to be retrieved (reference point) offset reference point

 

Select * From trom_daTa limit nnumrecord offset nbaserow

Indicates that the nbaserow row (index based on 0) (including the row) is used to retrieve the nnumrecord after the row.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.