{"id":2645,"date":"2013-08-10T08:19:16","date_gmt":"2013-08-10T08:19:16","guid":{"rendered":"http:\/\/www.withdata.com\/ad\/?p=2645"},"modified":"2017-04-20T11:09:44","modified_gmt":"2017-04-20T11:09:44","slug":"how-to-limit-the-number-of-rows-returned-by-an-sqlite-query","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/sqlite\/how-to-limit-the-number-of-rows-returned-by-an-sqlite-query.html","title":{"rendered":"How to limit the number of rows returned by a Sqlite query"},"content":{"rendered":"<p>In MySQL, you can use &#8220;Limit &lt;skip&gt;,&lt;count&gt;&#8221;, like this:<\/p>\n<pre>select *\r\nfrom sometable\r\norder by name\r\nlimit 20,10<\/pre>\n<p>How to do in Sqlite?<\/p>\n<p>You can still use &#8220;Limit &lt;skip&gt;,&lt;count&gt;&#8221;:<\/p>\n<pre>select *\r\nfrom sometable\r\norder by name\r\nlimit 20,10<\/pre>\n<p>or use equivalent query &#8220;Limit &lt;count&gt; offset &lt;skip&gt;&#8221;:<\/p>\n<pre>select *\r\nfrom sometable\r\norder by name\r\nlimit 10 offset 20<\/pre>\n<p>In Oracle: <a href=\"https:\/\/www.withdata.com\/blog\/oracle\/how-to-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering.html\">https:\/\/www.withdata.com\/blog\/oracle\/how-to-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering.html<\/a> .<\/p>\n<p>In SQL Server:\u00a0<a href=\"https:\/\/www.withdata.com\/blog\/sql-server\/the-sql-server-equivalent-for-the-mysql-limit.html\">https:\/\/www.withdata.com\/blog\/sql-server\/the-sql-server-equivalent-for-the-mysql-limit.html<\/a>\u00a0.<\/p>\n<p>In DB2:\u00a0<a href=\"https:\/\/www.withdata.com\/blog\/db2\/the-db2-equivalent-for-the-mysql-limit.html\">https:\/\/www.withdata.com\/blog\/db2\/the-db2-equivalent-for-the-mysql-limit.html<\/a>\u00a0.<\/p>\n<p>In Mysql: <a href=\"https:\/\/www.withdata.com\/blog\/mysql\/how-to-limit-the-number-of-rows-returned-by-an-mysql-query.html\">https:\/\/www.withdata.com\/blog\/mysql\/how-to-limit-the-number-of-rows-returned-by-an-mysql-query.html<\/a> .<\/p>\n<p>In PostgreSQL: <a href=\"https:\/\/www.withdata.com\/blog\/postgresql\/how-to-limit-the-number-of-rows-returned-by-an-postgresql-query.html\">https:\/\/www.withdata.com\/blog\/postgresql\/how-to-limit-the-number-of-rows-returned-by-an-postgresql-query.html<\/a> .<\/p>\n<p>For more information, you can see this page:\u00a0<a href=\"http:\/\/stackoverflow.com\/questions\/3325515\/sqlite-limit-offset-query-doubt\">http:\/\/stackoverflow.com\/questions\/3325515\/sqlite-limit-offset-query-doubt<\/a><\/p>\n<p>Some SQLite tools you can try: <a href=\"https:\/\/www.withdata.com\/sqlite\/\"> https:\/\/www.withdata.com\/sqlite\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In MySQL, you can use &#8220;Limit &lt;skip&gt;,&lt;count&gt;&#8221;, like this: select * from sometable order by name limit 20,10 How to do in Sqlite? You can still use &#8220;Limit &lt;skip&gt;,&lt;count&gt;&#8221;: select * from sometable order by name limit 20,10 or use equivalent query &#8220;Limit &lt;count&gt; offset &lt;skip&gt;&#8221;: select * from sometable order by name limit 10 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[429],"tags":[289,1369],"class_list":["post-2645","post","type-post","status-publish","format-standard","hentry","category-sqlite","tag-equivalent-for-the-mysql-limit","tag-sqlite"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=2645"}],"version-history":[{"count":6,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2645\/revisions"}],"predecessor-version":[{"id":6461,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2645\/revisions\/6461"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=2645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=2645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=2645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}