简体   繁体   中英

Normalization (3NF) on a simple table of two columns

I have a table with only two attributes (DeliveryPerson and DeliveryTime). Each person can deliver a “product” at a specific Delivery Time. As you can see below John for example has delivered three products at different delivery times.

在此处输入图像描述

According to my task, I must put this table in 3NF, but I am confused because I cannot set “deliveryPerson” as a primary key because there are repeated values in this column. Is there any way of setting up this table to satisfy 3NF? If that is not possible, is it correct to have a table like this in a DB without a Primary key?

Thank you very much!

Normalisation is not about adding Primary Keys to a table where you've already decided the columns, it's about deciding what tables and columns you need in the first place. The inability to define a Primary Key on this table is the problem you've been asked to solve; the solution will involve creating new tables.

Rather than looking at the table, look at the data you're trying to model:

  • There are four (and probably any number of) delivery people
  • Each delivery person can have one or more (maybe even zero) delivery times

A normalised database will represent each of those separately. I'll leave the details for you to work out, rather than feeding you the full answer.

There are plenty of tutorials available which will probably explain it better than me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM