mysql - How to create table of tables c# my sql -


i got site selling products. in database have 3 tables: users, countries, products.

each user can sale products in many countries. when clients come visit, site, can choose search product country , product price( same product sold same user can have different prices in each country).

i thought 2 implementations this:

  1. create linked table user_id, country_id, product_id. in case each time add new product need update 2 tables, linked table , products table.
  2. or create new table each country, have products in it. when have add new product need update 1 table.

i second solution more, because think perform faster, both reading , inserting, how ever it's management hard, have lots of tables, , if instead of counties use cities, thousandths of tables.

  • is there way in mysql create table of tables?
  • what think design perform faster?

do not go second solution. relational databases meant have fixed number of tables, , run lot of problems if try have variable amount of tables in manner describe.

if understood requirements correctly, should use 2 linked tables: 1 contains user_id , country_id (thus telling each user may sell products), , 1 contains country_id, product_id, , price (thus telling price of each product in each country). (this assumes product costs same within country no matter sells it.)


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -