1 / 15

Databases 103

Databases 103. Entities and Attributes. Two Entities. ENTITY( Primary Key , Attribute, Attribute2, Attribute3, Foreign Key ). CUSTOMER( Cid , Name, Address, DOB, Postcode, Allowed, Vid ) VIDEO( Vid , Name, Cast, Rating, Condition). Attribute = Name. Attribute = Postcode. Attribute = DoB.

bruis
Download Presentation

Databases 103

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. Databases 103

  2. Entities and Attributes

  3. Two Entities ENTITY(Primary Key, Attribute, Attribute2, Attribute3, Foreign Key) CUSTOMER(Cid, Name, Address, DOB, Postcode, Allowed, Vid) VIDEO(Vid, Name, Cast, Rating, Condition)

  4. Attribute = Name Attribute = Postcode Attribute = DoB Entity = Customer Attribute = Address Attribute = CUSTID Entities and Attributes Attribute = Age Attribute = Title Entity = DVD Attribute = Condition Attribute = DVDID

  5. Databases Two and Three Student Course Repeating Group

  6. The three normal forms

  7. First idea ….. • STUDENT(student number, student name, DoB, Sex, course1, course2, course3) • COURSE(course number, course name, teacher number, teacher name) This is called a repeating attribute It is not allowed in First Normal form This is called a repeating attribute It is not allowed in First Normal form

  8. First idea ….. • STUDENT(student number, student name, DoB, Sex, course number) • COURSE(course number, course name, teacher number, teacher name) This is called a repeating attribute It is not allowed in First Normal form This is called a repeating attribute It is not allowed in First Normal form

  9. First Normal Form • STUDENT(student number, student name, DoB, Sex, course number) • COURSE(course number, course name, teacher number, teacher name)

  10. First Normal Form No repeating attributes or repeating groups of attributes

  11. Second Normal Form Key • No partial dependencies What does that mean? Student name and sex are dependent only on part of the key They are unrelated to Course no.

  12. Second Normal Form • STUDENT(student number, student name, DoB, Sex) • STUDENT_TAKES(student number, course number) • COURSE(course number, course name, teacher number, teacher name)

  13. Many to Many in Second Normal Form Student Course Link Student Course

  14. Third Normal Form • No ‘non key’ dependencies In this case, teacher name is dependent on teacher no, not course number So we break the table into two

  15. Third Normal Form • STUDENT(student number, student name, DoB, Sex) • STUDENT_TAKES(student number, course number) • COURSE(course number, course name, teacher number) • TEACHER(teacher number, teacher name)

More Related