0

so far this is what i have code wise, but im getting an error 1239 . Is it not referencing something correctly .

CREATE TABLE CustomerDim ( C_CustomerID_Cu INT(10) NOT NULL, C_FacilityReservationNumber_Cu INT(10) NOT NULL, I_EventCode_Cu INT(10) NOT NULL, CONSTRAINT C_CustomerID_Cu FOREIGN KEY (C_CustomerID_Cu) REFERENCES CustomerDIM ); CREATE TABLE RoomDim ( C_RoomNumber_Ro INT(10) NOT NULL, C_RoomType_Ro INT(5) NOT NULL, C_RegionID_Re INT(4) NOT NULL, C__ResortCode_Fa INT(10) NOT NULL, CONSTRAINTC_RoomNumber_Ro FOREIGN KEY(C_RoomType_Ro) refereREFERENCES nces RoomDIM ); CREATE TABLE ReservationFact ( C_RoomReservationNumber_Rr INT (10) NOT NULL, C_CustomerID_Cu INT (10) NOT NULL, C__RoomType_Ro INT (10) NOT NULL, C_D_ArrivalDate_Rr DATE, C_EmployeeNumber_Em INT (5) NOT NULL C_ResortCode_Rs INT (10), CONSTRAINT C_RoomReservationNumber_Rr_pk PRIMARY KEY (C_RoomReservationNumber_Rr) ); 
2
  • Referal table must be defined after referent table, and it must refer to an expression which is index expression or index prefix in referent table. Commented Mar 30, 2020 at 20:39
  • (unrelated comments) The (5) means nothing; change to SMALLINT. Add on UNSIGNED. Have PRIMARY KEYs on every table. Commented Apr 7, 2020 at 22:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.