170 likes | 409 Views
Entity Relationship Diagrams. 3.3.1. This presentation covers. What is an Entity What is an Entity Relationship Diagram? Different types of relationships. Introduction. Systems can be confusing things. To help people understand what they are trying to design they often use diagrams.
E N D
This presentation covers • What is an Entity • What is an Entity Relationship Diagram? • Different types of relationships
Introduction • Systems can be confusing things. • To help people understand what they are trying to design they often use diagrams. • There are different styles of diagrams including: • Entity Relationship Diagrams • State Transition Diagrams • Data Flow Diagrams • Flowcharts • The type of diagram used will depend on the system being designed but a combination of diagrams can be used on the same project.
Entity Relationship Diagrams • Also known as ERDs. • This diagram represents entities and the relationships between them. • We have already looked at these diagrams when we covered Normalisation back in AS Level...so this will be more of a refresher topic!
Entities • Entities are ‘things’. • Each entity is made up of attributes. • For example, a is an entity. • It is made up of leaves... and other things.
Entities • Strictly speaking... • The is also an entity...as it too is made up of different attributes!
Types of Relationship • There are different types of relationship which you need to be aware of: • One-to-One • One-to-Many • Many-to-Many
One-to-One • Assuming a teacher only taught in one classroom in a school... Teacher Classroom
One-to-Many • A teacher has many lessons but a lesson can only have one teacher. Teacher Lesson
Many-to-Many • A teacher has many students and a student can have many teachers. • Many-to-Many relationships are never ideal so a third table is often created. Teacher Students
Fixing Many-to-Many • A third table is added to create two One-to-Many relationships. Teacher Students Class
Developing the ERD • You must know the following things: • The entities • The attributes for each entity • The primary key for the entity • The foreign key(s) in each entity
Something for you to do... • A small guesthouse registers its guests on a database. • Three of the entities used in the database are CUSTOMER, ROOM and BOOKING. • Draw an ERD to represent this part of the database.