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

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -