advancedTop 15 Database Design Questions
Design a product catalog with complex variable attributes (electronics, clothing, furniture).
categories(id, name, parent_id FK, attribute_schema JSONB) — defines valid attributes per category products(id, name, sku UNIQUE, price DECIMAL, category_id FK, status, created_at) product_attributes(product_id FK, attributes JSONB, PRIMARY KEY(product_id)) — JSONB for flexibility GIN index: CREATE INDEX ON product_attributes USING GIN(attributes) Query: WHERE attributes @> '{"color": "red", "size
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
Design a product catalog with complex variable attributes (electronics, clothing, furniture).