MySQL Forums
Forum List  »  Chinese

5.7SQL开发建一张表报错
Posted by: jie Shen
Date: July 28, 2018 08:57PM

mysql> create table city(
-> city_id smallint unsigned not null auto_increment,
-> city varchar(50) not null,
-> country_id smallint unsigned not null,
-> last_update timestamp not null default current_timestamp on update current_timestamp,
-> primary key(city_id),
-> key idx_fk_country_id(country_id),
-> constraint 'fk_city_country' foreign key (country_id) references country (country_id) on delete restrict on update cascade
-> )
-> engine=innodb
-> default charset=utf8;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''fk_city_country' foreign key (country_id) references country (country_id) on de' at line 8
mysql>

Options: ReplyQuote


Subject
Views
Written By
Posted
5.7SQL开发建一张表报错
27842
July 28, 2018 08:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.