英文:
Cannot create table in myslq 8.0
问题
我在尝试在MySQL命令行中创建表格时遇到错误,如图所示点击此处查看图像描述。我试图创建表格,但出现了语法错误1064,提示我在语法中有错误。
英文:
I am getting an error when i am trying to create a table in mysql command line as shown in the imageenter image description here
I was trying to create a table and got a syntax error 1064 stating I have an error in the syntax.
答案1
得分: 1
SQL语法中存在错误。在表名后面的CREATE语句中缺少逗号。
CREATE TABLE favorite_food (
person_id SMALLINT UNSIGNED,
food varchar(20),
PRIMARY KEY (person_id, food),
FOREIGN KEY (person_id) REFERENCES person (person_id)
);
英文:
There is an error in your SQL syntax. The CREATE statement does not contain a comma after the table name.
CREATE TABLE favorite_food (
person_id SMALLINT UNSIGNED,
food varchar(20),
PRIMARY KEY (person_id,food),
FOREIGN KEY(person_id) REFERENCES person (person_id)
);
答案2
得分: 0
创建表favorite_food(
person_id SMALLIT UNSIGNED,
food VARCHAR(20),
PRIMARY KEY (person_id,food),
FOREIGN KEY(person_id) REFERENCES person (person_id)
);
英文:
CREATE TABLE favorite_food(
person_id SMALLIT UNSIGNED,
food VARCHAR(20),
PRIMARY KEY (person_id,food),
FOREIGN KEY(person_id) REFERENCES person (person_id));
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论