Probléme création Table avec clef étrangère
Résolu
jeremy9871
Messages postés
27
Date d'inscription
Statut
Membre
Dernière intervention
-
fiu -
fiu -
Bonjour,
Quand je crée cette table tous ce passe bien :
CREATE TABLE informations (
Id int(10) unsigned NOT NULL AUTO_INCREMENT,
Id_Campagne int(10) unsigned NOT NULL,
Date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
MesurePression float unsigned NOT NULL,
MesureDebit float unsigned NOT NULL,
Mode tinyint(3) unsigned NOT NULL,
ConsigneDebit float unsigned NOT NULL,
ConsignePression float unsigned NOT NULL,
VitesseRotation float unsigned NOT NULL,
Frequence float unsigned NOT NULL,
Puissance float unsigned NOT NULL,
Tension float unsigned NOT NULL,
Courant float unsigned NOT NULL,
PRIMARY KEY (Id)
) ENGINE=InnoDB
Mais quand je crée celle ci un message d'erreur s'affiche
CREATE TABLE campagnes (
Id_informations int(10) unsigned NOT NULL,
Id int(10) unsigned NOT NULL AUTO_INCREMENT,
Nom char(20) NOT NULL,
INDEX inf_id (Id_informations),
FOREIGN KEY (Id_informations) REFERENCES informations(Id)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it
must be defined as a key
Merci de votre aide.
Quand je crée cette table tous ce passe bien :
CREATE TABLE informations (
Id int(10) unsigned NOT NULL AUTO_INCREMENT,
Id_Campagne int(10) unsigned NOT NULL,
Date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
MesurePression float unsigned NOT NULL,
MesureDebit float unsigned NOT NULL,
Mode tinyint(3) unsigned NOT NULL,
ConsigneDebit float unsigned NOT NULL,
ConsignePression float unsigned NOT NULL,
VitesseRotation float unsigned NOT NULL,
Frequence float unsigned NOT NULL,
Puissance float unsigned NOT NULL,
Tension float unsigned NOT NULL,
Courant float unsigned NOT NULL,
PRIMARY KEY (Id)
) ENGINE=InnoDB
Mais quand je crée celle ci un message d'erreur s'affiche
CREATE TABLE campagnes (
Id_informations int(10) unsigned NOT NULL,
Id int(10) unsigned NOT NULL AUTO_INCREMENT,
Nom char(20) NOT NULL,
INDEX inf_id (Id_informations),
FOREIGN KEY (Id_informations) REFERENCES informations(Id)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it
must be defined as a key
Merci de votre aide.
A voir également:
- Probléme création Table avec clef étrangère
- Table ascii - Guide
- Table des matières word - Guide
- Clef usb non reconnue - Guide
- Creation compte gmail - Guide
- Création site web - Guide