创建3张表:(不用设主外键)
@Override
public void onCreate(SQLiteDatabase db) {
System.out.println("同时创建3张数据库表");
db.execSQL("CREATE TABLE "+ "test1" +" (test1_id INTEGER PRIMARY KEY AUTOINCREMENT, test11desc VARCHAR(50), test12desc VARCHAR(50))");
db.execSQL("CREATE TABLE "+ "test2" +" (test2_id INTEGER PRIMARY KEY AUTOINCREMENT, test21desc VARCHAR(50), test22desc VARCHAR(50))");
db.execSQL("CREATE TABLE "+ "test3" +" (test3_id INTEGER PRIMARY KEY AUTOINCREMENT, test31desc VARCHAR(50), test32desc VARCHAR(50))");
}
多表查询:
public void query(){
db = helper.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT test1.test11desc , test2.tes