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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -