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

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Design a healthcare appointment system with HIPAA compliance.← Back to all SQL questions