0
votes

This is my sql query:

CREATE TABLE estados (
    id int IDENTITY(1,1) PRIMARY KEY,
    nombre VARCHAR(20) NOT NULL,
    paridad int NOT NULL
);

and it keeps telling me:

#1064 - 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 '(1,1) PRIMARY KEY, nombre VARCHAR(20) NOT NULL, paridad int NOT NULL

I don't know why is this, I am using 10.1.10-MariaDB. I don't know why I have syntax error, and if this has to do with the versions.

1
I believe IDENTITY is not supported b MySQL. Try its counterpart, AUTO_INCREMENT. - Felix Pamittan

1 Answers

0
votes

IDENTITY is for SQL Server. You should use AUTO_INCREMENT instead:

CREATE TABLE estados (
    id int AUTO_INCREMENT PRIMARY KEY,
    nombre VARCHAR(20) NOT NULL,
    paridad int NOT NULL
);