-1

i have two table one has a primary key called idHotel i am making a second table and im trying to declare a foreign key which has idHotel reference this my code what wrong with it

CREATE TABLE Evaluation(
DateEval date ,
Idhotel int  ,
NoteAccueil int,
NoteRest int,
NoteExtra int ,
FOREIGN key Idhotel REFERENCES hotel(Idhotel)

)

in case you want the reference table code here it is

refrence table

Shadow
  • 33,525
  • 10
  • 51
  • 64

1 Answers1

0

Please try the below code

CREATE TABLE Evaluation(
DateEval date ,
Idhotel int  ,
NoteAccueil int,
NoteRest int,
NoteExtra int ,
FOREIGN key (Idhotel) REFERENCES hotel(Idhotel));