Search code examples
sql-servermodel-view-controllerdatabase-designasp.net-mvc-3-areas

select 2 prefererences using checkbox and put in a single table


I have a reservation table

enter image description here

and a Preference table

enter image description here

And now i have a dropdownlist from wich i chose a preference when i am making a reservation.what i want to do is to use checkbox when i am making reservation so that i can select more preferences.Is this posibile ?how can i save two preferences in same reservation table.


Solution

  • You'd have to create a linking table with two columns: ReservationID and Preference_Id (possibly Preference_Quantity as well). ReservationID and Preference_Id would constitute the unique key for the table. This table would have FK constraints to the two original tables.

    You'd have to remove Preference_Id and Preference_Quantity from the reservation table