Bonjour, j'ai crée une base sur WampServer:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE faq (
ID_FAQ 	     number		NOT NULL,
titre 	     varchar2(255) 	NOT NULL,
texte 	     varchar2(255) 	NOT NULL,
hits 	     number 		NOT NULL,
adherent      number 		NOT NULL,
constraint pk_faq primary key (ID_FAQ)
);
 
CREATE TABLE adherent (
id_adherent 	     number		NOT NULL,
civilite	     char(2)		NOT NULL,
nomPrenom 	     varchar2(50) 	NOT NULL,
identifiant	     char(8)		NOT NULL,
email		     varchar2(200) 	NOT NULL,
constraint pk_adherent primary key (id_adherent)
);
Je voudrais ajouter une clé étrangère:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
ALTER TABLE faq ADD
CONSTRAINT fk_adherent FOREIGN KEY (adherent)
REFERENCES adherent(id_adherent);
Mais ça me retourne l'erreur suivante:

Erreur : SQL logic error or missing database
near "ALTER": syntax error

Qu'est ce qui ne va pas?

merci