title: paging in sqlite table using c#
body: <p>I'm trying to page through this table so I ended up with this query (which is not working).</p>
  
  <pre><code>SELECT MIN(user_uid) AS FIRST,
  MAX(user_uid) AS LAST,
  user_number, user_name
  FROM user_table
  WHERE user_uid &gt; MAX(FIRST,{0}) AND user_uid &lt; MIN(LAST,{1})
  AND ( user_name LIKE '%{2}%' OR user_number LIKE '%{3}%' )
  AND user_category={4} OR user_category={5}
  ORDER BY user_uid LIMIT {6}
  </code></pre>
  
  <p>I'm getting parameters' values from my c# variables. I'm storing FIRST, LAST externally to use them for moving to next/previous pages.</p>
  
  <p>I created this index too:</p>
  
  <pre><code>CREATE INDEX idx1 ON user_table (user_uid);
  </code></pre>
  
  <p><strong>please note:</strong> I saw <a href="https://stackoverflow.com/questions/14468586/efficient-paging-in-sqlite-with-millions-of-records">this answer</a>, but this is the only way I thought about to get First and Last values.</p>
  
  <p>How to page in this table efficiently?</p>