Search code examples
mysqlprimary-keyuniqueskus

Why should we use SKU since we have unique IDs


We use a unique id to sync products between our application and retailers.

Most of application are using SKU to identify the product, BUT why should we use a second id (SKu) if we already have one (primary incremental id key) ?


Solution

  • Primary keys are mainly for database use. When a database references an item, it does not care for the structure of the primary key, on that it's unique

    Although this could mean we could use many different forms, the reality is you want to keep your architecture as efficient & simple as possible. SKU's and other details (as referenced by sqlvogel) are attributes of particular database objects, and can change with time. Primary keys do not