How would I go about setting up several tables that need to pull info from one another?
Here's my scenario...
Table Products (15 different items)
id, name, price, features
Table Orders
id, user_id, date, time, products, total_price
My problem is that when an order comes in it can have a variety of combinations when it comes to the products selected. Ex: 4x items with (id=3), 7x items with (id=9) etc etc...
How do I store that so that it can be easily retrieved and fast to process without over complicating things?
One way I can think of is storing products as a json array. Something like:
{"4":3,"7":9,"1":14}
I've never worked with stuff like that before so no clue how challenging data retrieval would be.
Any tips are greatly appreciated...