SQLite复合键错误

时间:2013-12-06 17:04:51

标签: java android sql sqlite

为什么我收到以下声明的错误?

create table if not exists patient_to_prescs(

patient_id INTEGER NOT NULL REFERENCES patients_table(id)

presc_id INTEGER NOT NULL REFERENCES prescs_table(id)

PRIMARY KEY(patient_id, presc_id))

这是在android中,错误是 near "prescs_id": syntax error(code 1)

1 个答案:

答案 0 :(得分:3)

使用此功能,您缺少“,”:

create table if not exists patient_to_prescs(

patient_id INTEGER NOT NULL REFERENCES patients_table(id),

presc_id INTEGER NOT NULL REFERENCES prescs_table(id),

PRIMARY KEY(patient_id, presc_id));