Databases 7 min read

Analysis and Design of an E‑commerce Product Model: SPU, SKU, Attributes, and Specifications

The article explains the fundamental concepts of SPU and SKU in e‑commerce, describes how to model products, attributes, and specifications in database tables, and illustrates the design with diagrams while discussing trade‑offs such as redundancy and extensibility for large‑scale systems.

Architecture Digest
Architecture Digest
Architecture Digest
Analysis and Design of an E‑commerce Product Model: SPU, SKU, Attributes, and Specifications

This article revisits the product model of an e‑commerce system, clarifying the concepts of SPU (Standard Product Unit) and SKU (Stock Keeping Unit) and how they relate to real‑world items and their specific variants.

In the e‑commerce context, a SPU represents a generic product (e.g., iPhone 6) that users recognize, while a SKU denotes a concrete item with defined attributes such as color, memory size, and network type (e.g., gold‑16G‑mobile iPhone 6). The SPU is linked to categories and brands, and the SKU stores price and variant‑specific data.

Two tables—SPU and SKU—each have their own codes to facilitate inventory statistics and backend management; price resides in the SKU table because different variants have different prices. A many‑to‑many relationship can be used when a SPU belongs to multiple categories.

The product detail page is essentially a SKU detail page, showing price, color, version, capacity, etc. To support this, two additional concepts are introduced: "attribute" (e.g., color, version, capacity) and "attribute option" (e.g., gold, silver, 16 GB). Attributes have a one‑to‑many relationship with attribute options, while attribute options have a many‑to‑many relationship with SKUs.

Attributes are defined per category to simplify management; for example, the "mobile" category has attributes like color, version, and capacity, while the "shirt" category has color and size. To avoid redundancy, attributes can be modeled as many‑to‑many across categories, sacrificing some duplication for better merchant experience.

"Specification" represents the detailed parameters of a SKU, some of which are displayed on the product detail page and others on the list‑page filter. The specification table can be configured to control which fields appear where.

The final product model combines SPU, SKU, attributes, attribute options, and specifications, as shown in the comprehensive diagram below.

While this provides a solid foundation, a production‑grade e‑commerce system would extend the model further to handle multiple price types (market price, cost price, promotional price), cost accounting, marketing activities, bundle pricing, and more.

Source: http://www.cnblogs.com/leefreeman/p/4564886.html

Copyright statement: Content is sourced from the internet and belongs to the original author. We credit the author and source unless otherwise confirmed; please contact us if there is any infringement.

BackendE-commerceDatabase DesignSPUSKUproduct model
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.