jerrrrrry
Messages postés60Date d'inscriptiondimanche 18 mai 2003StatutMembreDernière intervention29 juillet 2009
-
11 avril 2008 à 20:58
jerrrrrry
Messages postés60Date d'inscriptiondimanche 18 mai 2003StatutMembreDernière intervention29 juillet 2009
-
12 avril 2008 à 16:40
bonjour à tous
je cherche à creer une requete sql
pour creer deux tables catégorie et sous catégorie
la table catégorie contient les champs id et name
la table souscategorie contient les champs cat,id et name
le champs cat fait reference au champs id de categorie
j'ai fait ça tapé ds phpmyadmin 2,6,1 qui gère mysql 4,1,9:
<hr size="2" width="100%" /><ol id="code1" class="olcode"><li>CREATE TABLE categorie (</li><li>id int(11) UNSIGNED NOT NULL auto_increment ,</li><li>name VARCHAR(30) NOT NULL default '',</li><li>PRIMARY KEY(id),</li><li>
</li><li>) ENGINE=InnoDB DEFAULT CHARSET=utf8;</li><li>
</li><li>CREATE TABLE souscategorie (</li><li>cat int(11) UNSIGNED NOT NULL auto_increment ,</li><li>id int(11) NOT NULL auto_increment ,</li><li>name varchar(30) NOT NULL default '',</li><li>PRIMARY KEY(cat),</li><li>FOREIGN KEY(cat) REFERENCES categorie(id) ON DELETE NO ACTION ON UPDATE NO ACTION,</li><li>) ENGINE=InnoDB DEFAULT CHARSET=utf8;</li></ol>
<hr size="2" width="100%" />ça marche pas à la place :
j'obtient une erreur #1064 - Erreur de syntaxe pr�s de ') ENGINE=InnoDB DEFAULT CHARSET=utf8' � la ligne 6
jerrrrrry
Messages postés60Date d'inscriptiondimanche 18 mai 2003StatutMembreDernière intervention29 juillet 2009 12 avril 2008 à 16:40
il y a une virgule de trop à la ligne 4
ligne 9 il faut virer auto_increment
ligne 12 il faut remplacer PRIMARY KEY(cat), par PRIMARY KEY(id)
il faut shooter la virgule ligne 14
bref bcp (trop) d'erreurs