title: SQLite database android create table
body: <p>"I got error "No Such Table" and cause me to try everything possible to make it gone, now it's gone, but i'm confuse. Here is my situation</p>
  
  <p>I have 2 tables need to create in the apps. and i put one class per table and it's look like code below. If i follow this it will hit me with "No Such Table" when i pull data from "Table2", so i need to change the DATABASE_NAME to some other value = "DB2"; then the "Table2" will create successfully and able to pull out data. </p>
  
  <p>So my question is this a correct way to make sure 2 tables create successfully? or i should not seperate table into 2 classes? Pls advise</p>
  
  <pre><code>public class DB1 extends SQLiteOpenHelper {
  // Database Version
  private static final int DATABASE_VERSION = 1;
  
  // Database Name
  private static final String DATABASE_NAME = "DB";
  
  // Labels table name
  private static final String TABLE_STORE = "Table1";
  
  // Labels Table Columns names
  public static final String KEY_1 = "col1"; 
  
  public RC_StoreTbl(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  // Creating Tables
  @Override
  public void onCreate(SQLiteDatabase db) {
      // Category table create query
      String CREATE_TABLE = "CREATE TABLE " + TABLE_STORE + "("
              +KEY_1 + " INTEGER PRIMARY KEY)";
      db.execSQL(CREATE_TABLE);
  }
  }
  </code></pre>
  
  <p>Another class</p>
  
  <pre><code>public class DB2 extends SQLiteOpenHelper {
  // Database Version
  private static final int DATABASE_VERSION = 1;
  
  // Database Name
  private static final String DATABASE_NAME = "DB";
  
  // Labels table name
  private static final String TABLE_STORE = "Table2";
  
  // Labels Table Columns names
  public static final String KEY_1 = "col1"; 
  
  public RC_StoreTbl(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  // Creating Tables
  @Override
  public void onCreate(SQLiteDatabase db) {
      // Category table create query
      String CREATE_TABLE = "CREATE TABLE " + TABLE_STORE + "("
              +KEY_1 + " INTEGER PRIMARY KEY)";
      db.execSQL(CREATE_TABLE);
  }
  }
  </code></pre>