I'm completely new to databases, and I'd like some insight on how to design a PostgreSQL database with this schema I have in mind. I'm not sure how to implement primary/foreign keys and relations in this case to achieve what I want.
I have created a a large table of customers, with the following information:
CUSTOMER
- unique ID
- review of the product ("positive", "negative")
- full name
Now, each CUSTOMER needs to have a PRODUCT table (which can be empty) and which contains a list of products:
PRODUCT
- product ID
and each product in this PRODUCTS table needs to be associated with an ITEMS table (which can also be empty), which contains a list of items.
ITEMS
- item ID
In the end, I want to be able to order individual items from the ITEMS table based on how "positive" or "negative" the customer reviews were. How do I implement foreign and primary keys in this case to be able to design this effectively?
Any insight would be much appreciated,
Thanks