2. ER Diagrams – 4marks Flashcards
Why is conceptual modelling important?
Without conceptual models, it is very difficult to communicate database designs to (non-technical) users - This lack of communication may result in user’s data requirements being missed or incorrect requirements being captured
The type of conceptual model used in this course is…
Entity Relationship (ER) Model, by drawing ER diagrams (ERD’s).
What is a Universes of Discourse (UoD)?
The UoD is the relevant portion of the real world to be modelled by the database, i.e a mini world
The database to be built will not model everything in the world but everything in the UoD
An entity has the following properties…
- Real-world object distinguishable from other objects (e.g a student, car, job, subject, building etc.)
- is described by a set of attributes.
- On an ER diagram, shown as entity name (noun) in a rectangle
An attribute can be of the types…
- Composite Vs. Simple Attributes
- Single-valued Vs. Multi-valued Attributes
- Derived Vs. Stored Attributes
In general attributes are represented on an ER diagram by
a circle with the attribute name.
Key attributes have the following properties…
- Key (or uniqueness) constraints
- Key attribute’s values are distinct for each individual entity
- Key must hold for every possible extension of the entity type
- Multiple keys are possible
- On an ER diagram, a key attribute has its name underlined inside the oval
Value set attributes have the following properties…
- Specifies the set of values that may be assigned to a particular attribute of an entity (eg: Employee Age: Integers between 21 & 65 or Vehicle Registration Number: String of 3 alphabets followed by 3 integers)
- Value sets map to relational domains
- Value sets are not displayed on the ER diagram
NULL valued attributes have the following properties and types…
Properties
• Applies if a particular entity does not have an applicable value for an attribute
Types of Null Values
• Not Applicable (eg: Tertiary-Degree is Not applicable for a person with no university education)
• Unknown (eg: Home-Phone is Not known even if it exists)
• Missing (eg: Person’s Height: Not known at present time)
Composite attributes are…
• attributes can be divided into smaller parts which represent simple attributes with independent meaning (eg: name can be broken into First name and Last name)
Compare Single and multivalued attributes…
- Single value only allows one value (eg: Gender is M or F, not both) whereas multivalued can have more than one (eg: Degree = {BSc, BInfTech}
- On an ER diagram, single have a single bordered circle, while multivalued have a double border.
Derived attributes have the following properties…
- Can be derived from related attribute values: (Age Date - B-day)
- On an ERD, represented by a broken line border circle.
Constraints which can be defined using ER model include
• Cardinality Constraints
• Participation Constraints
(Together called “Structural Constraints” )
Cardinality ratios for ER are:
- 1:1
- 1:N
- M:N
Consider the conditions:
One employee can only work in one department, but one department can have many employees.
What is the cardinality of this relationship and on which side of the relationship is each side of the ratio drawn?
ANSWER:
It is a 1:N relationship
The 1 goes on the side of the department and the N goes on the side of the employee.