2011년 8월 22일 월요일

SQLite - ... has more than one primary key

DB Table ("T_TIMETABLE ") 생성시 에러 발생

table "T_TIMETABLE" has more than one primary key


CREATE TABLE 구문은...


CREATE TABLE IF NOT EXISTS T_TIMETABLE ( subject_id text primary key, day text primary key, begin_tm text primary key, end_tm text primary key )


SQLite 에서 1개 이상의 칼럼을 기본 키로 설정 하고 싶다면

CREATE TABLE 문을 아래와 같이 사용해야 한다.


CREATE TABLE IF NOT EXISTS T_TIMETABLE ( subject_id text, day text, begin_tm text, end_tm text, PRIMARY KEY ( subject_id, day, begin_tm, end_tm) )

댓글 없음:

댓글 쓰기