1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Addresses stored in a database should you normalize?

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 1, 2024 às 09:43.

  1. Stack

    Stack Membro Participativo

    quick question.

    consider the following table (UK):

    • CustomerID (PK)
    • First Name
    • Surname
    • House_No/name
    • street
    • City
    • Postcode

    Would you split off address into another table? basic business assumption is that a customer cannot have more than one address.

    originally i seperated this off to look something like this:

    Customer Table

    • CustomerID (PK)
    • FirstName
    • Surname
    • AddressID (FK)

    Address Table

    • AddressID(PK)
    • Postcode(FK)
    • House_Number_name

    Postcode Table:

    • Postcode (PK)
    • StreetName
    • CityID(FK)

    City Table

    • CityID (PK)
    • CityName

    unless i have my assumptions wrong that a postcode uniquely identifies a streetname and city is this not in 3NF?

    Continue reading...

Compartilhe esta Página