I have a problem i need to reference a single foreign key to a composite key in another table.
My database structure is as following:
CREATE TABLE av
If you reference a composite primary key, your foreign key also needs to contain all those columns - so you need something like:
FOREIGN KEY (available_trip_code, date)
REFERENCES available_trip (trip_code, date)
If you don't already have all those columns present in your table, then you'll need to add them.
alter table booking add constraint FK_Booking_TripAndDate
foreign key (available_trip_code,date)
references available_trip(trip_code, date)