0

MySQLで作成されたこの単純なテーブルを取得するのに苦労しています:

create table events (
    id int,
    when timestamp not null,
    summary varchar(256) not null,
    description varchar(500) not null,
    owner int not null,
    attendee int not null,
    PRIMARY KEY(id),
    FOREIGN KEY(owner) REFERENCES calendar_users(id),
    FOREIGN KEY(attendee) REFERENCES calendar_users(id)
);

FK の説明と PK ステートメントは問題ありません。しかし、MySQL はなぜか 3 行目に問題があるようです。誰でも私を助けてください。ありがとう。

4

2 に答える 2

1

whenは予約語です。

名前として使用するには、バッククォートで囲みます。

于 2013-08-08T15:15:01.207 に答える
1

whenは予約語です ( http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html )

フィールドのタイトルを変更するだけでよいでしょう。たとえば、日時を使用します

于 2013-08-08T15:17:02.140 に答える