2

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
Mureinik
  • 297,002
  • 52
  • 306
  • 350
TOMAS
  • 55
  • 4
  • 11
  • Possible duplicate of [When to use single quotes, double quotes, and backticks?](http://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks) – Franz Gleichmann Nov 25 '16 at 08:16

1 Answers1

2

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)
);
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Thank you Mureinik , that is fast , it work , but before a create another table with the quotes **``** and it works.. Maybe MariaDB woks with this quotes **``** and not with this `''`... anyway thanks again.. – TOMAS Nov 25 '16 at 08:23
  • 1
    Maybe MariaDB woks with this quotes `` and not with this `''`... – TOMAS Nov 25 '16 at 08:29
  • @TOMAS backticks (`) are used to escape object names - they are perfectly fine to use (although they are redundant in this case). Regular quotes (') are something completely different. – Mureinik Nov 25 '16 at 08:50