<i id='eBipT'><tr id='eBipT'><dt id='eBipT'><q id='eBipT'><span id='eBipT'><b id='eBipT'><form id='eBipT'><ins id='eBipT'></ins><ul id='eBipT'></ul><sub id='eBipT'></sub></form><legend id='eBipT'></legend><bdo id='eBipT'><pre id='eBipT'><center id='eBipT'></center></pre></bdo></b><th id='eBipT'></th></span></q></dt></tr></i><div id='eBipT'><tfoot id='eBipT'></tfoot><dl id='eBipT'><fieldset id='eBipT'></fieldset></dl></div>

  • <tfoot id='eBipT'></tfoot>

      <small id='eBipT'></small><noframes id='eBipT'>

      <legend id='eBipT'><style id='eBipT'><dir id='eBipT'><q id='eBipT'></q></dir></style></legend>

        <bdo id='eBipT'></bdo><ul id='eBipT'></ul>

        Sqlite LIMIT/OFFSET 查询

        Sqlite LIMIT / OFFSET query(Sqlite LIMIT/OFFSET 查询)

            • <legend id='gTZaS'><style id='gTZaS'><dir id='gTZaS'><q id='gTZaS'></q></dir></style></legend>
            • <tfoot id='gTZaS'></tfoot>

              <i id='gTZaS'><tr id='gTZaS'><dt id='gTZaS'><q id='gTZaS'><span id='gTZaS'><b id='gTZaS'><form id='gTZaS'><ins id='gTZaS'></ins><ul id='gTZaS'></ul><sub id='gTZaS'></sub></form><legend id='gTZaS'></legend><bdo id='gTZaS'><pre id='gTZaS'><center id='gTZaS'></center></pre></bdo></b><th id='gTZaS'></th></span></q></dt></tr></i><div id='gTZaS'><tfoot id='gTZaS'></tfoot><dl id='gTZaS'><fieldset id='gTZaS'></fieldset></dl></div>
              • <bdo id='gTZaS'></bdo><ul id='gTZaS'></ul>

                <small id='gTZaS'></small><noframes id='gTZaS'>

                    <tbody id='gTZaS'></tbody>

                  本文介绍了Sqlite LIMIT/OFFSET 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 Sqlite 有一个简单的问题.这有什么区别:

                  I have simple question with Sqlite. What is the difference between this:

                  Select * from Animals LIMIT 100 OFFSET 50
                  

                  Select * from Animals LIMIT 100,50
                  

                  推荐答案

                  这两种语法形式有点混乱,因为它们颠倒了数字:

                  The two syntax forms are a little confusing because they reverse the numbers:

                  LIMIT <skip>, <count>
                  

                  相当于:

                  LIMIT <count> OFFSET <skip>
                  

                  它与 MySQL 和 PostgreSQL 的语法兼容.MySQL 支持两种语法形式,它的 docs 声称第二种带有 OFFSET 的语法旨在提供与 PostgreSQL 的兼容性.PostgreSQL docs 显示它只支持第二种语法,并且 SQLite 的文档 表明它支持两者,推荐第二种语法以避免混淆.

                  It's compatible with the syntax from MySQL and PostgreSQL. MySQL supports both syntax forms, and its docs claim that the second syntax with OFFSET was meant to provide compatibility with PostgreSQL. PostgreSQL docs show it only supports the second syntax, and SQLite's docs show that it supports both, recommending the second syntax to avoid confusion.

                  顺便说一下,使用 LIMIT 而不先使用 ORDER BY 可能并不总是给您想要的结果.实际上,SQLite 会以某种顺序返回行,这可能取决于它们在文件中的物理存储方式.但这并不一定意味着它按您想要的顺序排列.获得可预测顺序的唯一方法是显式使用 ORDER BY.

                  By the way, using LIMIT without first using ORDER BY may not always give you the results you intend. In practice, SQLite will return the rows in some order, probably determined by how they're physically stored in the file. But this doesn't necessarily mean it's in the order you want. The only way to get a predictable order is to use ORDER BY explicitly.

                  这篇关于Sqlite LIMIT/OFFSET 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  Defining a one-to-one relationship in SQL Server(在 SQL Server 中定义一对一关系)
                  SQLite loop statements?(SQLite 循环语句?)
                  Can I use parameters for the table name in sqlite3?(我可以在 sqlite3 中使用表名的参数吗?)
                  SQL - Inserting a row and returning primary key(SQL - 插入一行并返回主键)
                  <tfoot id='DVtVL'></tfoot>

                1. <legend id='DVtVL'><style id='DVtVL'><dir id='DVtVL'><q id='DVtVL'></q></dir></style></legend>

                          <tbody id='DVtVL'></tbody>

                        <small id='DVtVL'></small><noframes id='DVtVL'>

                          <bdo id='DVtVL'></bdo><ul id='DVtVL'></ul>
                        • <i id='DVtVL'><tr id='DVtVL'><dt id='DVtVL'><q id='DVtVL'><span id='DVtVL'><b id='DVtVL'><form id='DVtVL'><ins id='DVtVL'></ins><ul id='DVtVL'></ul><sub id='DVtVL'></sub></form><legend id='DVtVL'></legend><bdo id='DVtVL'><pre id='DVtVL'><center id='DVtVL'></center></pre></bdo></b><th id='DVtVL'></th></span></q></dt></tr></i><div id='DVtVL'><tfoot id='DVtVL'></tfoot><dl id='DVtVL'><fieldset id='DVtVL'></fieldset></dl></div>