sql - Database design for products table -
i have product table , category table in database.
a product can have (n) number of categories.
what best design tables , fields performance , optimization?
products table -------------- id name ... categories table ---------------- id name ... product_categories table ------------------------ product_id category_id
if want products of category do
select p.* products p join product_categories pc on pc.product_id = p.id join categories c on pc.category_id = c.id c.name = 'shoes'
Comments
Post a Comment