I'm trying to create a table with mySQL and it's throwing me the Error in your SQL syntax
error and I can't figure out what is wrong with my table
CREATE TABLE IF NOT EXISTS GalleryBase.Artist(
Artist_ID_No int PRIMARY KEY,
First_Name varchar(255),
Last_Name varchar(255),
Country varchar(255),
Style varchar(255),
Alive CHAR(1),
Exhibition_Name varchar(255),
CONSTRAINT exhibition_fk FOREIGN KEY (Exhibition_Name) REFERENCES Exhibition(Exhibition_Name);
It says the error is on ln 9 at '' (two single quotes with no space between), which is the CONSTRAINT
line, but if I delete that line, it says the error is on 8.
I'm not sure where this error near '' is.
您尚未关闭GalleryBase.Artist(
括号,在结尾处加上了括号。
Consider something like this:
CREATE TABLE IF NOT EXISTS GalleryBase.Artist(
Artist_ID_No serial PRIMARY KEY,
First_Name varchar(255) not null,
Last_Name varchar(255) not null,
Country varchar(255) null,
Alive tinyint null,
Unique (first_name,last_name)
);
Exhibitions would not normally appear in this table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.