Database optimization orders

前端 未结 4 551
心在旅途
心在旅途 2020-11-29 14:01

In a database where users can place orders, is it better to have a new table with addresses or each order has the address data in its header.

4条回答
  •  我在风中等你
    2020-11-29 14:37

    In general you will most likely want to separate:

    • Users
    • Addresses
    • Order information

    This is because users can change address over time, but old addresses need to be kept because they have orders against them. Plus a single user can have multiple orders from the same address, so we separate out this information to reduce duplication.

    http://en.wikipedia.org/wiki/Database_normalization

提交回复
热议问题