140 likes | 231 Views
Textbook info : ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Copy Number Status at EIU SSN of student Student Name Student Major Course ID(s) Title of Course(s) Credit for course(s). Define data required.
E N D
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Copy Number Status at EIU SSN of student Student Name Student Major Course ID(s) Title of Course(s) Credit for course(s) Define data required Here are some fields used by textbook library. They need to know what books are used for what classes. They also need to know what books are checked out by what students. One student can have many individual books checked out, but one individual book can be used by only one student at a time. One course can use many books and the same set of books can be used by multiple classes.
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Copy Number Status at EIU SSN of student Student Name Student Major Course ID(s) Title of Course(s) Credit for course(s) Define data required 1. Select the Primary Key
First Normal Form – Remove Repeating Fields • Textbook info: • ISBN • Author • Book Title • Publisher • Date Published • Edition • Date Adopted at EIU • EIU Copy Number • Status at EIU • SSN of student • Student Name • Student Major • Course ID(s) • Title of Course(s) • Credit for course(s) • Remove repeating groups into a new entity. • Copy the PK of the new entity to link back to the original entity • Select the PK for the new entity. Usually of PK of the original key plus a unique component of the repeating group.
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU EIU Copy Number Status at EIU SSN of student Student Name Student Major Course ID(s) Title of Course(s) Credit for course(s) First Normal Form – Remove Repeating Fields • Remove repeating groups into a new entity. • Copy the PK of the new entity to link back to the original entity • Select the PK for the new entity. Usually of PK of the original key plus a unique componentof the repeating group.
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU EIU Copy Number Status at EIU SSN of student Student Name Student Major First Normal Form – Remove Repeating Fields • Copy the PK of the new entity to link back to the original entity • Select the PK for the new entity. Usually of PK of the original key plus a unique component of the repeating group. • Remove repeating groups into a new entity. There is still a repeating group in the original entity so we get to do it again. • Textbook-Course info: • ISBN FK • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Copy Number Status at EIU SSN of student Student Name Student Major First Normal Form – Remove Repeating Fields • Remove repeating groups into a new entity. • Copy the PK of the new entity to link back to the original entity • Select the PK for the new entity. Usually of PK of the original key plus a unique component of the repeating group. • Textbook-Course info: • ISBN • Course ID(s) • Title of Course(s) • Credit for course(s) There are many individual copies of books for one ISBN (set of books)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU First Normal Form – Remove Repeating Fields • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student • Student Name • Student Major • Textbook-Course info: • ISBN FK • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Second Normal Form – Remove Partial Dependencies • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student • Student Name • Student Major Check tables with composite keys. Are any of the non-key attributes dependent on only part of the key? • Textbook-Course info: • ISBN FK • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Second Normal Form – Remove Partial Dependencies • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student • Student Name • Student Major Check tables with composite keys. Are any of the non-key attributes dependent on only part of the key? • Textbook-Course info: • ISBN FK • Course ID(s) • Title of Course(s) • Credit for course(s) Yes, Title/Credit are dependent on only the Course ID [part of the key]. Move title/credit to a new table and copy the course ID.
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Second Normal Form – Remove Partial Dependencies • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student • Student Name • Student Major • Textbook-Course info: • ISBN FK • Course ID(s) FK • Course info: • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Third Normal Form – Remove Non-key Dependencies • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student • Student Name • Student Major Student Name and Major are dependent on SSN of student. All of these are non-key fields. Move the non-key fields that are dependent on another non-key field to another table. Copy of field that they are dependent on to that table. It will be the PK of the new table. • Textbook-Course info: • ISBN FK • Course ID(s) FK • Course info: • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Third Normal Form – Remove Non-key Dependencies • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student FK • Student info: • SSN of student • Student Name • Student Major • Textbook-Course info: • ISBN FK • Course ID(s) FK • Course info: • Course ID(s) • Title of Course(s) • Credit for course(s)
Textbook info: ISBN Author Book Title Publisher Date Published Edition Date Adopted at EIU Remove easily computed fields • Textbook-Copy info: • ISBN FK • Copy Number • Status at EIU • SSN of student FK • Student info: • SSN of student • Student Name • Student Major • Textbook-Course info: • ISBN FK • Course ID(s) FK • Course info: • Course ID(s) • Title of Course(s) • Credit for course(s) There are no easily computed fields in this example.
Student info: SSN Name Major Check the ERD for consistency • Textbook info: • ISBN • Author • Book Title • Publisher • Date Published • Edition • Date Adopted at EIU Course/Textbook info: • Course ID FK • ISBN FK Course info: • Course ID • Title of Course • Credit 1:M M:1 M 1:M Textbook Copies info: • ISBN • Copy Number • Status at EIU FK • SSN of student M:1