Luis Andrade
Pregunta¿Como soluciono este error?
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AUTO_INCREMENT,
Mi query
CREATE TABLE IF NOT EXISTS products (
product_id INTEGER PRIMARY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
stock INTEGER UNSIGNED NOT NULL DEFAULT 0,
price INTEGER UNSIGNED NOT NULL DEFAULT 0,
)

Sebastian Cardona Franco
debes escribir en el mismo renglon todo antes de la coma y debes corregir la primary key , solo dice primary
asi me corrio bien
CREATE TABLE IF NOT EXISTS products ( -> product_id INTEGER PRIMARY KEY AUTO_INCREMENT, -> name VARCHAR(100) NOT NULL, -> stock INTEGER UNSIGNED NOT NULL DEFAULT 0, -> price INTEGER UNSIGNED NOT NULL DEFAULT 0);

Facundo Nicolás García Martoni
No es necesario que elimines la palabra PRIMARY, simplemente debes agregar KEY después 😉

Francisco Raymundo Reynoso Banderas
Eliminando la palabra PRIMARY de tu product_id
en MySQL debes colocarlo de esta forma
CREATE TABLE IF NOT EXISTS products (
product_id INTEGER NOT NULL AUTO_INCREMENT
…
…
PRIMARY KEY(product_id)
)
y NOT NULL es para que no contenga valores nulos