SQL. How to reference a composite primary key Oracle?
问题 I have two parent tables: Treatment and Visit . Treatment table: create table Treatment ( TreatCode CHAR(6) constraint cTreatCodeNN not null, Name VARCHAR2(20), constraint cTreatCodePK primary key (TreatCode), ); Visit table: create table Visit ( SlotNum NUMBER(2), DateVisit DATE, ActualArrivalTime DATE, constraint cVisitSlotDatePK primary key (SlotNum, DateVisit) ); Now I try to create a child table: create table Visit_Treat ( TreatCode constraint cTreatCodeFK references Treatment(TreatCode)