Learning Normalisation (1 Viewer)

Steve R.

Retired
Local time
Yesterday, 20:53
Joined
Jul 5, 2006
Messages
4,699
In taking a look at your image of your structure, you have some structural problems. The field you use as a "Primary Key" should not be a field that could be changed, such as your "order id".

The purpose of a primary key is to link tables. If a Primary Key (PK) is changed, such as an order number, it will disrupt things to be polite.

The purpose of a table is to contain all items (attributes) that describe a certain thing, such as a product. Consequently, your product table would contain a Foreign Key (FK) for suppliers and a FK for prices. This can be complicated if there are multiple suppliers, multiple prices, and if historic prices need to be tracked. It will be up to you to design the database to address those issues.

I suggest that you do an internet search on "normalization". You will get many hits.

I found this book to be very helpful: "Base Tutorial: From Newbie to Advocate in a one, two... three!". This is not an MS Access PDF, but it still serves the purpose of teaching/learning "normalization".
 
Last edited:

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
@Steve R.
Thank you for having a time to reply/suggest/recommend :)
i have downloaded the book and will try to study it out.
really appreciated!

[orderID] - it's an Autonumber. it cannot be changed
[product] - can be supplied by many supplier with different prices and unit. so i created a junction table ProductPrices

Historical Price - definitely yes! i need to track the prices to know the trend. but I DONT KNOW HOW TO DESIGN IT.
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
Last edited:

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
@jdraw
Thanks! I'll check on it
 

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

why does it have a table of shipment items?

can't it just relate directly to orderItems and Shipments?

Thanks!
 

Attachments

  • toClarify.PNG
    toClarify.PNG
    79.5 KB · Views: 223

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
My best guess is that an Order may consist of multiple items. But since it is a partial delivery/shipment, only those items in the delivery/shipment are identified, and are also invoiced.

So the Order has many items.
Some items from the Order are delivered in a shipment and are invoiced
Many shipments are required to deliver all items in the Order
Invoices from all shipments constitute the Order Invoice

In his model he also accommodates CreditNotes for Returned Items

You may not need all of these tables/relationships, but it is a generic model that someone built and published as an aid to the rest of us. It may not represent your business processes.

Good luck.

PS: What type of Lucidchart account do you have?
 
Last edited:

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

i think it's the shipment_items.
it can cater several items and shipment in 1 invoice ID.
anyway. with that as guide. is this new revision close to that?

Thanks!
 

Attachments

  • jdraw BarryWilliams v1.PNG
    jdraw BarryWilliams v1.PNG
    36 KB · Views: 173

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
Your deliveryDetails does not identify Product (or OrderItem).

Also a question for your "business", you purchase Products from Suppliers. You have a purchasePrice for each SupplierSuppliedProduct, and that Price can change from one Purchase to another. You also sell those Products to Customers, so you have some sort of SellingPrice, which can also change from time to time.

I recommend you include the AgreedToSellingPrice with the OrderDetail record.

You can make up some sample data, and some business scenarios,then test your model to make sure you can store and retrieve the required data.

What type of Lucidchart account are you using?

I remember helping someone with CustomerProductsDelivery and Receipt of Goods(attached has some of same features as you're using)
 

Attachments

  • OrderDeliveryAndGoodsReceived.jpg
    OrderDeliveryAndGoodsReceived.jpg
    49.3 KB · Views: 187
Last edited:

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

the items in delivery details are in order table down to orderDetail. is that the right relationship to do?

selling price - yes i must include that
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
Suppose you have an Order Id 1000, and it has 5 OrderItems a,b,c,d,e.
If you have to Deliver OrderId 1000 items a,c,d ---I think you have to include those in the DeliveredItems table (If you have a Bill of Lading or some list identifying what was delivered, I think you would want it and even a copy signed by the Receiver. You wouldn't want the Receiver to come back and say you didn't deliver c,d - Now you have "proof" and Receiver's signature.
 

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

oh i get it! thanks!

so i need to create another table that would link to deliveryDetails. and the deliveryDetails would have a status of delivery?
 

isladogs

MVP / VIP
Local time
Today, 01:53
Joined
Jan 14, 2017
Messages
18,246
I created a free account and checked the link out of interest.
It worked but was very slow to load for some reason. Over 30 sec

Its a very neat tool....

Does the fact that its a shared link mean it can be edited by others?
I haven't as I'm testing on my tablet.

I'll leave Jack to comment on the design as I don't want to tread on his toes.
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
I looked at your link and was invited to share the diagram.

At this point you have an evolving logical model. You might want to list your business facts and verify that each is represented in the model. After that I suggest you create some test data and scenarios and play stump the model.

Here are some of the facts --you can add/adjust/remove as needed. Note I have used Products and Items in the facts. I have not included Invoicing since it isn't in your model. I did not include Dates with Order or Deliveries, you can add details where needed.

You have a number of Suppliers
A Supplier may supply 1 or more Products
Each Supplied Product has a PurchasePrice
You have 1 or more Customers that can be uniquely identified.
A Customer creates 1 or more Orders
An Order may contain 1 or more Products
An Ordered Product has a SellingPrice
You may negotiate an AgreedToPrice for a Product with a Customer (sale/clearance/loyalty)
An Order may be "pickedUp"/"carried out" by the Customer
An Order may be Delivered to Customer (may consider a ShipTo address)
Delivery(s) may be for full or partial Order (all or some of the OrdererProducts)
A Delivery is made by a Courier
A Delivery includes a List of DeliveredItems
The Customer is provided the list of DeliveredItems
The Customer verifies the receipt and signs a copy of the List of DeliveredItems


For scenarios you could consider the following, and adjust as necessary to create "business scenarios". You could add more complexity, but suggest you start with this and add detail as the model gets vetted.

Supplier X offers Products P1, P2 and P3 with unit prices $20, $25 and $40 respectively.
Customer CustJim makes an Order for 5 units of P2 and 1 unit of P3 and wants it delivered.
For some reason only 3 units of P2 are available. So FedY -the courier company- makes a partialDelivery of 3 units of P2 and 1 unit of P3 to CustJim
.


You can test your model using pencil and paper.

NOTE: I use AgreedToPrice as the Price a unit of Product when sold to this Customer on this Order.
This allows you to change Product prices. It preserves historical Order info related to Prices paid for Product(s). It also allows you to have special prices for certain Customers; loyalty programs; clearance sales and Specials etc...

Good luck.
 

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

i hope lucidchart could allow a collaboration of designer in 1 drawing though so i can see exactly what you want to have.

i will try to test (stump the model) when this diagram is in good shape. it's really hard to redesign it again with all the relationships set.

i have here the 4th version of my drawing based on your suggestion.

please see if i have it right. attributes at the right entity.

thanks!

https://www.lucidchart.com/invitations/accept/cdbfd94e-7bc4-43bf-bbf2-5f69c8b848d5
 

Attachments

  • orderDiagram v4.PNG
    orderDiagram v4.PNG
    81.2 KB · Views: 168

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:53
Joined
Jan 23, 2006
Messages
15,380
Looks promising. Time for stump the model. See if it can handle what you need.

When I looked at your previous model, I was given a "free account".

Did my business facts match your requirements?
 

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
Exactly!

I just cant understand the latter part. confused with all those couriers and receipts.
did my model got it right?
 

jmq

Registered User.
Local time
Yesterday, 17:53
Joined
Oct 4, 2017
Messages
87
jdraw,

why do we need to link order to delivery if delivery can be partial?
why don't we link it directly to orderDetails instead?

like this:
 

Attachments

  • orderDiagram v4.1.PNG
    orderDiagram v4.1.PNG
    52.6 KB · Views: 148

Users who are viewing this thread

Top Bottom