Newbie needs help with MySQL Error

Hi - I’m a total newbie trying to create a MySQL database for pubs in my town. I have the following error message:
CREATE TABLE IF NOT EXISTS Bars.Bars/Cafes/Restaurants (
Bars/Cafes/Restaurants_ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(45) NOT NULL,
Owner VARCHAR(45) NULL,
Location VARCHAR(45) NULL,
Images VARCHAR(45) NULL,
Hours VARCHAR(45) NULL,
Genre VARCHAR(45) NULL,
Email VARCHAR(45) NULL,
Description TEXT NULL,
Telephone VARCHAR(45) NULL,
Live Music VARCHAR(45) NULL,
Games Nights VARCHAR(45) NULL,
Email VARCHAR(45) NULL,
PRIMARY KEY (Bars/Cafes/Restaurants_ID),
UNIQUE INDEX Name_UNIQUE (Name ASC) VISIBLE)
ENGINE = InnoDB

SQL script execution finished: statements: 5 succeeded, 1 failed

Fetching back view definitions in final form.
Nothing to fetch
Not sure how to fix this, Please help - Thnx

Hey there,

Did you make this query yourself, or is it being ran by some other program?

The table name looks off to me, I am not sure if MySQL supports / characters in the name of the table. Could you try to change it from Bars.Bars/Cafes/Restaurants to just Restaurants?

You should also not include any spaces in your column names. So Live Music needs to be something like Live_Music.

Also be careful with VARCHAR(45) this means you can only have 45 characters in that field, but I can imagine a lot of places may have a longer name than 45 characters, same goes for Email.

1 Like