简体   繁体   中英

MARIADB ERROR 1064 (42000) when CREATE TABLE

When I try to create a table:

MariaDB [heladeria]> create table sabores ('Id_sabores' int NOT
NULL,'sab_nombre' varchar(255) NOT NULL, 'calorias' varchar(255) NOT
NULL, PRIMARY KEY (Id_sabores));

I get the following error:

ERROR 1064 (42000): You have an error
in your SQL syntax; check the manual that corresponds to your MariaDB
server version for the right syntax to use near ''Id_sabores' int NOT
NULL,'sab_nombre' varchar(255) NOT NULL, 'calorias' varchar' at line 1

Single quotes ( ' ) are used to denote string literals, not object (in this case - column) names. Just remove them and you should be fine:

create table sabores (
    Id_sabores int NOT NULL,
    sab_nombre varchar(255) NOT NULL, 
    calorias varchar(255) NOT NULL, 
    PRIMARY KEY (Id_sabores)
);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM