Hello i am still learning and i faced this problem,please how can i fix it ?
A symbol name was expected! (near “id” ) At least one column definition was expected. (near “id” ) Unexpected beginning of statement. (near “11” ) Unrecognized statement type. (NOT NULL)
CREATE TABLE "categories" ( "id" int(11) NOT NULL, "name" varchar (255) NOT NULL ) "ENGINE" = INNODB DEFAULT CHARSET = lantin1; CREATE TABLE "stages" ( "id" int (11) NOT NULL, "categorie_id" int(11) NOT NULL, "entreprise" varchar(255) NOT NULL, "nome" varchar(255) NOT NULL, "description" varchar(255) NOT NULL, "location" varchar(255) NOT NULL, "contact" varchar(255) NOT NULL, "contact_email" varchar(255) NOT NULL ) ENGINE = INNODB DEFAULT CHARSET = latin1; ALTER TABLE "categories" ADD PRIMARY KEY ("id"); ALTER TABLE "stages" ADD PRIMARY KEY ("id"); ALTER TABLE "categories" MODIFY "id" int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE "stages" MODIFY "id" int(11) NOT NULL AUTO_INCREMENT;
how can i fix it’s showing a lot of errors,i am still learning please help me
Advertisement
Answer
You should remove all ” characters like below:
CREATE TABLE categories ( id int(11) NOT NULL, name varchar (255) NOT NULL ) ENGINE = INNODB DEFAULT CHARSET = lantin1; CREATE TABLE stages ( id int (11) NOT NULL, categorie_id int(11) NOT NULL, entreprise varchar(255) NOT NULL, nome varchar(255) NOT NULL, description varchar(255) NOT NULL, location varchar(255) NOT NULL, contact varchar(255) NOT NULL, contact_email varchar(255) NOT NULL ) ENGINE = INNODB DEFAULT CHARSET = latin1; ALTER TABLE categories ADD PRIMARY KEY (id); ALTER TABLE stages ADD PRIMARY KEY (id); ALTER TABLE categories MODIFY id int(11) NOT NULL AUTO_INCREMENT; ALTER TABLE stages MODIFY id int(11) NOT NULL AUTO_INCREMENT;