I am very new to database design, and I have a rather high order from a client with very complex relationships in their data. What I'm trying to do is write the logic for recommending products based on the conditions that the client has. However, there are some interesting filters that need to be applied depending on the values ββof various other data bits. For example, some products are only for {men | women}, so depending on the value of say customers.customer_gender product is not recommended.
Of course, I could do all this in PHP, but it would be better if I could represent it in a database and just make it a form interface. That way, they can customize and modify these relationships as they add new products without releasing me to customize the code! My problem then is inexperienced. I do not understand how I should present this information in tables.
EDIT 1 - Try an example
Imagine you have the following tables:
Client
id name gender -- ---- ------ 1 Bob male 2 Mary female 3 Steve male
condition
id name -- ---- 1 Headaches 2 Allergies 3 Low Energy
Products
id name description
and some other tables using foreign keys to determine the relationship between them, for example, which products are recommended for which conditions (a two-column table that combines the product identifier and the condition identifier), and which customers have what conditions.
Now I have certain products that can only be recommended to men, for example. Or only to people who are not sensitive to caffeine. Or who has a certain condition with a certain severity (where severity is an additional column in the table linking clients and conditions containing an int value from 1-3). How can I present these kinds of relationships ("recommend product X for condition Y, other than expression Z") in clean database tables?
user1452106
source share