gpt4 book ai didi

mysql - 在 phpmyadmin mysql 中创建表时出现错误

转载 作者:行者123 更新时间:2023-11-29 17:30:43 25 4
gpt4 key购买 nike

我需要创建一个表,这是 SQL 查询

CREATE TABLE person {
per_id int(10) not null AUTO_INCREMENT,
name varchar(256) not null,
clth_color varchar(256) not null,
per_photo varchar(256) not null,
age varchar(10) not null,
description text not null,
loaction varchar(256) not null,
type int(1) not null,
user_id int(10) not null,
primary key(per_id),
foreign key(user_id) references users(user_id)

};

但我收到错误

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在 '{

附近使用的正确语法
per_id int(10) not null AUTO_INCREMENT,
name varchar(256) not null,

' 在第 1 行

最佳答案

尝试使用 () 代替 {}

CREATE TABLE person (
per_id int(10) not null AUTO_INCREMENT,
name varchar(256) not null,
clth_color varchar(256) not null,
per_photo varchar(256) not null,
age varchar(10) not null,
description text not null,
loaction varchar(256) not null,
type int(1) not null,
user_id int(10) not null,
primary key(per_id),
foreign key(user_id) references users(user_id)
);

我不完全确定,但它可能会起作用。

关于mysql - 在 phpmyadmin mysql 中创建表时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50687173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com