Entity Relationship Modelling
- Pages: 5
- Word count: 1247
- Category: Relations
A limited time offer! Get a custom sample essay written according to your requirements urgent 3h delivery guaranteed
Order NowDefinitions
Entity
an aggregation of a number of data elements each data element is an attribute of the entity
Background
Introduced by Peter Chen in ‘75 now widely used You’ll find them in: Structured Systems Analysis and Design Methodology (SSADM) Information Engineering (IE) Multiview Yourdon/DeMarco.
Entity type
a class of entities with the same attributes
Relationship
an association between two or more entities that is of particular interest
Why use ER Diagrams ?
provides a global quick reference to an organization’s data structures. can be used individually to design an Information System’s (IS) data structure can be used with Data Flow Diagrams to provide a more comprehensive IS logical design.
ERD Development Process
Identify the entities Determine the attributes for each entity Select the primary key for each entity Establish the relationships between the entities Draw an entity model Test the relationships and the keys
A Simple Example
Identify the entities
Any entity can be classified in one of the following categories: Regular : any physical object, event, or abstract concept that we can record facts about.
STUDENTs attend COURSEs that consist of many SUBJECTs. A single SUBJECT (i.e. English) can be studied in many different COURSEs. Each STUDENT may only attend one COURSE.
Weak :
any entity that depends on another entity for its existence.
Determine the Attributes
Every Entity has attributes. Attributes are characteristics that allow us to classify/describe an entity e.g., entity STUDENT has the attributes: student number name date of birth course number
Key Attributes
Certain attributes identify particular facts within an entity, these are known as KEY attributes. The different types of KEY attribute are: Primary Key
Composite Primary Key
Foreign Key
Key Definitions
Primary Key:
One attribute whose value can uniquely identify a complete record (one row of data) within an entity.
Composite Primary Key
A primary key that consists of two or more attribute within an entity.
Foreign Key
A copy of a primary key that exists in another entity for the purpose of forming a relationship between the entities involved.
Entities and Attributes Entities are specific objects or things in the mini-world that are represented in the database. For example the EMPLOYEE Hulya Avsar, the Research DEPARTMENT, the GIS PROJECT Attributes are properties used to describe an entity. For example an EMPLOYEE entity may have a Name, TC number, Address, Sex, BirthDate A specific entity will have a value for each of its attributes. For example a specific employee entity may have Name=’Cem Yilmaz’, TCN=’123456789′, Address =’Uzun sk No:40 Kadikoy Istanbul Turkey’, Sex=’M’, BirthDate=’09-JAN-70‘ Each attribute has a value set (or data type) associated with it – e.g. integer, string, subrange, enumerated type, …
Types of Attributes
Simple
Each entity has a single atomic value for the attribute. For example, TCN or Sex.
Entity Types and Key Attributes
Entities with the same basic attributes are grouped or typed into an entity type. For example, the EMPLOYEE entity type or the PROJECT entity type.
Composite
The attribute may be composed of several components. For example, Address (Apt#, House#, Street, City, State, ZipCode, Country) or Name (FirstName, MiddleName, LastName). Composition may form a hierarchy where some components are themselves composite.
An attribute of an entity type for which each entity must have a unique value is called a key attribute of the entity type. For example, TCNo of EMPLOYEE.
A key attribute may be composite.
For example, course no and department code together constitutes a key like CENG 302 (there may be other 302 courses in other departments).
Multi-valued
An entity may have multiple values for that attribute. For example, Telehone Numbers or PreviousDegrees of a STUDENT. Denoted as {Telephone Number} or {PreviousDegrees}.
An entity type may have more than one key.
For example, for a vehicle both of the below numbers are unique Vehicle plate number Engine number
ER Diagram Components
Every entity diagram consists of the following components:
Entity (labelled box)
SUMMARY OF ER-DIAGRAM NOTATION FOR ER SCHEMAS
Symbol Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING RELATIONSHIP TYPE ATTRIBUTE
Course
KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE
Relationship line
E1 E1
R R R N (min,max)
DERIVED ATTRIBUTE
E2 E2 E
TOTAL PARTICIPATION OF E2 IN R CARDINALITY RATIO 1:N FOR E1:E2 IN R STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R
Degrees of relationship, alternative representation
One-to-one (1:1)
Degrees of a Relationship
One-to-one (1:1)
Man
One-to-many (1:n)
Woman
Man
One-to-many (1:n)
Woman
Customer
Many-to-many (n:m)
Order
Customer
Many-to-many (n:m)
M
Order
Course
Subject
Course
M
M
Subject
NOTE: Every many to many relationship consists of two one to many relationships working in opposite directions
NOTE: Every many to many relationship consists of two one to many relationships working in opposite directions
Notation for optional attributes
Person 1 M Car
A Sample ER Diagram
Student
A person must own at least one car. A car doesn’t have to be owned by a person, but if it is, it is owned 1 at least one person. A by person may own many cars.
Course
Subject
A Student Record Entity Diagram
optional relationship
mandatory relationship
Library Case Study
When a library first receives a book from a publisher it is sent, together with the accompanying delivery note, to the library desk. Here the delivery note is checked against a file of books ordered. If no order can be found to match the note, a letter of enquiry is sent to the publishers. If a matching order is found, a catalogue note is prepared from the details on the validated delivery note. The catalogue note, together with the book, is sent to the registration department. The validated delivery note is sent to the accounts department where it is stored. On receipt of an invoice from the publisher, the accounts department checks its store of delivery notes. If the corresponding delivery note is found then an instruction to pay the publishers is made, and subsequently a cheque is sent. If no corresponding delivery note is found, the invoice is stored in a pending file.
Summary
In today’s session we have learned to: Identify the entities Determine the attributes for each entity Select the primary key for each entity Establish the relationships between the entities Draw an entity model
A Case Study
Conference centre booking system
A conference centre takes bookings from clients who wish to hold courses or conferences at the centre. When clients make bookings they specify how many people are included in the booking, and of these, how many will be resident during the booking, and how many will require catered or non-catered accommodation at the centre. The centre contains a number of facilities which may be required by clients making bookings as follows: A. There are 400 bedrooms for clients who will be resident during the Course or conference. B. A maximum of 250 catered people can be handled at any one time. C. Six main lecture theatres providing seating for 200 people. D. Twenty seminar rooms each able to accommodate 25 people. E. Video conference facilities. The video conference facilities consist of four separate video conference networks. Each video conference network has a large screen based in one of the main lecture theatres, along with 3 satellite screens each of which is based in one of the seminar rooms. Draw an entity relationship diagram for the case, stating any assumptions you deem necessary.