Created by nurhidayah.mazni
over 9 years ago
|
||
Question | Answer |
ER DIAGRAM | ENTITY RELATIONSHIP MODELS • Entities and Attributes • Relationships • Attributes • E/R Diagrams |
DATABASE DESIGN | |
ENTITY / RELATIONSHIP MODELLING | - E/R Modelling is used for conceptual design. • Entities - objects or items of interest. • Attributes - facts about, or properties of, an entity. • Relationships - links between entities. |
ENTITY / RELATIONSHIP DIAGRAMS | • E/R Models are often as E/R diagrams that: •*Give a conceptual view of the database •*Are independent of the choice of DBMS *Can identify some problems in a design |
ENTITIES | • Entities represent objects or things of interest. • Physical things like students, lecturers, employees, products. • More abstract things like modules, orders, courses, projects. |
DIAGRAMMING ENTITIES | * In an E/R Diagram, an entity is usually drawn as a box with rounded corners. * The box is labelled with the name of the class of objects represented by that entity. |
ATTRIBUTES | Attributes are facts, aspects, properties, or details about an entity. • Students have IDs, names, courses, addresses, … • Modules have codes, titles, credit weights, levels, … |
DIAGRAMMING ATTRIBUTES | -In an E/R Diagram attributes may be drawn as ovals. • Each attribute is linked to its entity by a line. • The name of the attribute is written in the oval. |
RELATIONSHIPS | Relationships are an association between two or more entities. • Each Student takes several Modules • Each Module is taught by a Lecturer • Each Employee works for a single Department |
CARDINALITY RATIOS | Each entity in a relationship can participate in zero, one, or more than one instances of that relationship This leads to 3 typesof relationship… • One to one (1:1) - Each lecturer has a unique office • One to many (1:M) - A lecturer may tutor many students, but each student has just one tutor. • Many to many (M:M) -Each student takes several modules, and each module is taken by several students. |
DIAGRAMMING RELATIONSHIPS | * Relationships are links between two entities. * The name is given in a diamond box * The ends of the link show cardinality |
Removing M:M Relationships | * Many to many relationships are difficult to represent. * We can split a many to many relationship into two one to many relationships. * An entity represents the M:M relationship. |
MAKING ER MODELS | -To make an E/R model you need to identify • Enitities • Attributes • Relationships • Cardinality ratios - General guidelines • Since entities are things or objects they are often nouns in the description. • Attributes are facts or properties, and so are often nouns also. • Verbs often describe relationships between entities. |
EXAMPLE | A university consists of a number of departments. Each department offers several courses. A number of modules make up each course. Students enrol in a particular course and take modules towards the completion of that course. Each module is taught by a lecturer from the appropriate department, and each lecturer tutors a group of students. |
EXAMPLE - ENTITIES | |
EXAMPLE - RELATIONSHIPS | |
EXAMPLE : ER DIAGRAM | |
EXAMPLE : ER DIAGRAM | NOTES : PLEASE CHANGE THE CONNECTIVITY INTO " CHEN NOTATION". One-to-One One-to-Many Many-to-Many |
ENTITIES AND ATTRIBUTES | * Sometimes it is hard to tell if something should be an entity or an attribute.. * They both represent objects or facts about the world. * They are both often represented by nouns in descriptions. • General guidelines - Entities can have attributes but attributes have no smaller parts. - Entities can have relationships between them, but an attribute belongs to a single entity. |
EXAMPLE : ENTITIES AND ATTRIBUTES | |
EXAMPLE : ER DIAGRAM ENTITIES AND ATTRIBUTES | |
EXAMPLES : RELATIONSHIP | Some relationships between entities, A and B, might be redundant if: • It is a 1:1 relationship between A and B • Every A is related to a B and every B is related to an A. • Example - the supplier-address relationship Is one to one • Every supplier has an address. • We don’t need addresses that are not related to a supplier. |
EXAMPLE : ER DIAGRAM |
Want to create your own Flashcards for free with GoConqr? Learn more.