Bonjour,

J'essaie la commande suivante dans le but de créer une table qui est liée avec 3 tables filles. Celles-ci serviront à alimenter des listes déroulantes dans la table mère.

Code SQL : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE TABLE player (
  id serial,
  dg_id integer NOT NULL,
  playTeam_id integer NOT NULL,
  playPosition_id integer NOT NULL,
  playStatus_id integer NOT NULL,
  name varchar(150) NOT NULL,
  PRIMARY KEY (id),
  FOREIGN KEY (dg_id) REFERENCES dg(id),
  FOREIGN KEY (playTeam_id) REFERENCES tableFille1(id),
  FOREIGN KEY (playPosition_id) REFERENCES tableFille2(id),
  FOREIGN KEY (playStatus_id) REFERENCES tableFille3(id)  
);

Erreur obtenue :

#1005 - Can't create table `dbpool`.`player` (errno: 150 "Foreign key constraint is incorrectly formed")

P.S. Je débute vraiment avec MySQL.

Merci de m'aider.