sql - Part of a compund key as a foreign key avoiding redundancy -


hello have database thisdatabase tables.
can see hotel database holding information bookings,customers , rooms. problem bookings , bookdates tables. every customer makes booking can book few dates , don't have in order. that's why had create bookdates in order avoid thisenter image description here have problem of how relate 2 tables can't relate part of compound key other table. how bookdates table looks now. there no primary key.enter image description here

if understand question correctly can formulated this: relations (foreign , primary keys) have created relations between tables bookdates , bookings?

if question say, create primary key combining both fields in bookdates (the combination has unique). bookings has primary key on booknum. create foreign key field booknum in bookdates booknum in bookings.

one other point of attention: name tables , fields singular. example table bookdate, fields booknum , date. each record contains 1 bookdate. when retrieve multiple items table have list of bookdate records.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -