复合主键中的语法错误 android

syntax error in composite primary key android

String CREATE_FINANCE_TABLE = "CREATE TABLE " + TABLE_FINANCE + "("
                + FIN_USERID + " INTEGER PRIMARY KEY" + " REFERENCES " + TABLE_USER + "("+ USER_ID +")," 
                + FIN_CARID + " INTEGER," 
                + FIN_TOTALPRICE + " REAL, "
                + FIN_DOWNPAYMENT + " REAL," + FIN_BALANCE + " REAL, "
                + FIN_DOWNPAYMENTDATE + " TEXT," + FIN_INTEREST + " REAL, "
                + FIN_PERIOD + " INTEGER," + FIN_ISREMIND + " INTEGER, "
                + FIN_REMINDAY + " INTEGER," + FIN_AMOUNT + " REAL, "
                + FIN_NXTPYMNTAMT + " REAL," + FIN_NXTPYMNTDATE + " TEXT, "
                + FIN_REMINDERDATE + " TEXT," + FIN_REMINDERSTATUS + " INTEGER, "
                + FIN_ID + " INTEGER" + " PRIMARY KEY " + "( "+ FIN_USERID +" , "+ FIN_CARID +" ))";
        db.execSQL(CREATE_FINANCE_TABLE);

日志:

03-03 22:39:21.950: E/SQLiteLog(980): (1) near "(": syntax error
03-03 22:39:22.030: W/System.err(980): android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: CREATE TABLE finance(user_id INTEGER PRIMARY KEY REFERENCES user(id),mycar_id INTEGER,total_price REAL, down_payment REAL,balance_amount REAL, downpay_date TEXT,emi_interest_rate REAL, emi_period INTEGER,is_remind INTEGER, remind_day INTEGER,emi_amount REAL, next_payment_amount REAL,next_payment_date TEXT, reminder_date TEXT,reminder_status INTEGER, finance_id INTEGER PRIMARY KEY ( user_id , mycar_id ))

FIN_ID 列的声明缺少逗号 (,)。只需在 INTEGER 关键字后加一个逗号

+ FIN_ID + " INTEGER," + " PRIMARY KEY " + "( "+ FIN_USERID +" , "+ FIN_CARID +" ))";