Lesson Objectives Aims You should know about: 1.3.2: (a) Relational database, flat file, primary key, foreign key, secondary key, entity relationship modelling, normalisation and indexing.
Copyright A lot of material here is referenced from a lecture given at Nottingham University http://www.cs.nott.ac.uk/~psznza/G51DBS/dbs4.pdf
Entities An entity is an object Usually, entities convert in to tables in a database Entities, as tables, have attributes E.g. the entity “student” will have the attributes “name”, “d.o.b”
Entities
Attributes Attributes appear on ER diagrams as ovals But you don’t need to do them in the exam or on this course It’s nice to know about them, though, right?
Attributes
Relationships Entities have relationships This is a description of how they are related/connected together. They are represented by lines with a diamond shape in the middle. In the exam, the diagram is slightly different…
Relationships There are 3 types of relationship: One to One One to Many (or many to one) Many to Many These relationships are called “Cardinality”
Exam Diagrams In the exam, the diamond shape will be omitted:
Examples
Many to many Many to many relationships are a bad thing They are difficult to represent in a database Many to many relationships are not in 3nf
Task http://www.cs.nott.ac.uk/~psznza/G51DBS/dbs4.pdf Slide 15 – Examine the example and follow through how an ER diagram is produced. Make notes on identifying Entities, Attributes, relationships etc
Review/Success Criteria You should know: How to interpret ER symbols How to draw an ER diagram How to identify relationships, entities and attributes How to remove many to many relationships