G Barnaby Electronics Ltd case Study - Comparison of Entity-Relationship and Normalisation Database Designs G.1 Compare the two Database Designs created from the Entity-Relationship Model and Normalisation The Entity-Relationship diagram: requests places is requested by is made up of Quote was part of was ordered by Product is placed by Order is made up of is requested in is part of is for Quote Product is part of Appendix G Barnaby Electronics Ltd 1
The database diagram from the Normalisation process: CUSTOMER name QUOTE Name* * PRODUCT QUOTE PRODUCTS PRODUCTS G.2 Identify differences between the two Diagrams The following differences exist between the two diagrams: a) In the Entity-Relationship diagram, the entity has a one-tomany relationship with the Order entity, however, in the diagram from the Normalisation process, there is no such relationship. b) In the Entity-Relationship diagram, the Order entity has a one-to-many relationship with the Quote product entity. However, in the diagram from the Normalisation process, the Order table has a one-to-many 2 Mastering Database Design
relationship with a table called Order Products, that does not exist in the other diagram. There is also a one-to-many relationship from the Product table to the Order Products table. G.3 Examine the differences and select the most appropriate design a) Since in this system, a Quote is always linked to a, the relationship between the Quote and the and the Quote and the Order is sufficient to enable the to be found for any Order. From the Order you would find the Quote related to it, since the Quote to Order relationship is a one-to-many, there will only ever be one quote related to an Order. From the Quote, it is possible to find the, since again, there will only ever be one related to any Quote. The relationship between the and the Order can therefore be omitted. b) In this system, there will only ever be one Order Product for each Quote Product. It may be the case that a Quoted Product does not get Ordered, but an Ordered product will always have a Quote Product. It makes sense, therefore, to combine these two entities or tables into the table, as was done in the Entity-relationship diagram. In this way, the product table can still have a one-to-many relationship with the Quote Product, and the Order can also have a one-to-many relationship with the Quote product, although that relationship may not exist if there is no Order for that Quote. The Quote product table will need to be amended to include the Order Number as a foreign key, as in the Entity-Relationship Diagram entity item list. When tables for the Entity-Relationship database designs were initially created in Access, the table was set up with a Primary Key of, instead of name to ensure that each entry in the table was unique. This is an appropriate time to add that change to the model. G.4 Combine the two diagrams to reflect the above solutions Appendix G Barnaby Electronics Ltd 3
CUSTOMER QUOTE * * PRODUCT QUOTE PRODUCTS * G.5 Update Table Designs The tables deigns from the Normalisation process were used as a base, and the changes referred to in G.3 were applied. These changes are as follows: a) No changes required to the Normalised table list, since the -to- Order relationship did not exist in the Normalised model. b) The Quote Products and Order Products tables were combined into the Quote Products table. The Order Number became a foreign key of the Quote Products table. 4 Mastering Database Design
In addition, the name key for the table was changed to be, and the reference to Name in the Quote table was also changed to refer to the. Name Address Quote Quote Reference Number Contact Date * Contact name for Quote Purchasing Authorisation Date Quote Date Product Product Description Order Order Number Quote Reference Number* Order Date Contact for Order Acknowledgement Date Quote Products Quote Reference Number Quantity Single Purchase Price Single Sale Price Total Sale Price Estimated Delivery Date Order Number* Actual Delivery Date G.6 Update table designs to include new requirements The Problems and New Requirements section of the Feasibility study is referred to and the table is changed to include telephone number, fax number and e-mail address. Name Address Telephone Number Fax Number email Appendix G Barnaby Electronics Ltd 5