1 / 19

Normalisation

Normalisation. Ham Ham’s Hammy Club. Introduction. What is normalisation? “a technique for designing relational database tables to minimize duplication of information and, in so doing, to safeguard the database against certain types of logical or structural problems” wikipedia.com.

matana
Download Presentation

Normalisation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Normalisation Ham Ham’s Hammy Club

  2. Introduction • What is normalisation? “a technique for designing relational database tables to minimize duplication of information and, in so doing, to safeguard the database against certain types of logical or structural problems” wikipedia.com

  3. Ham Ham’s Hammy Club – Customer Record I’m kind of a big deal! MemberID: Initial: Surname: Title: Sex: Postcode: Tel No: Hammy Details:

  4. Ham Ham’s Hammy Club – Customer Record I’m kind of a big deal! MemberID: 0001 Initial: A Surname: Dolinski Title: Mr Sex: Male Postcode: HA1 HA1 Tel No: 0123456789 Hammy Details:

  5. Relationships • Hamster can have one owner • Owners can have many hamsters Hamster Owner

  6. Relationships • A hamster can only be one breed • A breed can have many hamsters Hamster Breed

  7. Relationships Owner Hamster Breed

  8. Ham Ham’s Hammy Club – Customer Record I’m kind of a big deal! MemberID: 0001 Initial: A Surname: Dolinski Title: Mr Sex: Male Postcode: HA1 HA1 Tel No: 0123456789 Hammy Details: We can see we already have issues with repeated data!

  9. Example Data

  10. Example Data Customer information is repeated

  11. Example Data Breed information is repeated

  12. Normalisation Rules • 1NF • No repeating attributes and primary key of non repeating data must be placed in table of repeating data. • 2NF • Look for non-key attributes that depend upon all the attributes in the compound primary keys i.e. does the attribute depend on both primary keys? • 3NF • Look for non-key attributes that depend upon other non-key attributes.

  13. Normalisation Table

  14. UNF – List out all fields

  15. 1nf – Apply Rules In some cases, you may need to add a new field to make a compound primary key.

  16. 2nf – Apply Rules This fixes the many-to-many problem!

  17. 3nf – Apply Rules Here we have a foreign key – a non-primary key that links to a primary key in another table.

  18. Normalised table!

  19. Remember!! • You don’t actually need to know how to normalise a database. It’s useful to know though because you’ll have a better understanding of it – it’ll also help in coursework! • However, you need to know the advantages of doing so and you’ll need to know the rules.

More Related