I have a form where there are preferences for a hotel customer. There are a lot of preferences, for instance, for the “Drink” category, there is “coca”, “wine”, “whiskey”. Customers can make multiple selection, for example, selecting both wine and coca for Drink. I have a table named “customer_preferences” to store their preferences in postgresql. The table will consist of the ID of the customer as primary key and columns like “Drinks” and “Leisure”. Now when a customer has selected “coca” and “wine” for drink, how can I store both these values? Also I am planning to use the database for data mining. My question is how can I store multiple values of preferences and the corresponding insert statement?
Thank you.
I have a form where there are preferences for a hotel customer. There are
Share
You’ll have CUSTOMER and PREFERENCE tables, with a one-to-many relationship between them.
You’ll have a single transaction that looks like this:
So you’ll have (n+1) INSERTs and one SELECT for a single CUSTOMER record and n PREFERENCE records.