title: SQLite ROW Limit
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2035670/limit-an-sqlite-tables-maximum-number-of-rows">Limit an sqlite Table&#39;s Maximum Number of Rows</a>  </p>
  </blockquote>
  
  
  
  <p>How can I limit the number of rows in my sqlite db? I would like to limit my db to 10 rows and give a message when an attempt to exceed that number is made. would this be done when the database is created or when querying the db</p>
  
  <p>creation:</p>
  
  <pre><code>String sqlDataStore = "create table if not exists " 
  + TABLE_NAME_INFOTABLE + " ("+ BaseColumns._ID + " integer primary key autoincrement," 
  
           + COLUMN_NAME_SITE + "text not null," 
           + COLUMN_NAME_ADDRESS + "text not null,"
           + COLUMN_NAME_USERNAME + "text not null,"
           + COLUMN_NAME_PASSWORD + "text not null)";
  
        db.execSQL(sqlDataStore); 
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code> Cursor cursor = database.query(databaseName.TABLE_NAME, null, null, null, null, null, databaseName.COLUMN_NAME, null);
  </code></pre>