Contents An Introduction Entities & Relationships Building an Entity-Relationship model Attributes and Identifiers Cardinality, Degree, Existence of Relationships
Life-Cyclen Requirements n specification of customer/user needs/desiresn Design n specification of potential solution or solution approachn Implementation n providing the solutionn Test Results n evaluations, inferences, reports, documentationn Modifications n changes/additions to solution
E-R Model (Peter Chen, 1976)n Diagrammaticn Simple but expressiven Easy to map into traditional DBMS modelsn Extensions n Extended ER Model n Entity Category Relationship Model n Enhanced ER Model
The Conceptual Model Conceptual model captures the global/ institutional view of the data semantics. It investigates and enumerates the various entities that participate in the business environment being modelled.
E-R Modeling Entity-Relationship (E-R) Modeling is a conceptual modeling tool. perceives the business environment in terms of participating “entities” and the “relationship” between them. e.g. many employees work for a department. works_ EMPLOYEE DEPARTMENT for entity relationship entity
Entity is a “data object” models some object/entity in the real-world; entity type represents the set of all similar objects. identified by the nouns in the requirements specification. must have a name that is unique across the entire model and has a consistent meaning across the modelling team and the end users.
Attributes characteristics/properties of an entity, that provide descriptive details of it. every attribute must be given a name that is unique across the entity (distinct entities may have attributes with the same name). attribute names are also subject to the same rules that govern entity names (consistent meaning, documentation, etc..)
Types of Attributesn Simple and compositen Single-valued and multivaluedn Nulln Derived
Simple and Composite Attributesn Simple Attribute: An attribute composed of a single component with an independent existence. E.g position and salary of the Staff entity.n Composite Attribute: An attribute composed of multiple components, each with an independent existence. E.g adress attribute of the branch entity that can be subdivided into street, city and postcode attributes.
Single-Valued and Multi- Valued Attributesn Single-Valued Attribute: An attribute that holds a single valuefor each occurrence of an entity type. E.g branchNo.n Multi-Valued Attributes: An attribute that holds multiple values for each occurrence of an entity type. E.g telephoneNo.
Derived Attributesn Derived Attributes: An attribute that represents a value that is derivable from the value of a related attribute or set of attributes, not necessarily in the same entity type. n E.g attribute duration which value is derived from the rentStart and rentFinish attributes.
Relationshipmodels the real-world association between twoor more entities (binary, n-ary relationship).A relationship can be optional or mandatory“degree” is the number of entity sets involved inthe relationship. typically 2 (binary); othercommon degrees are 1 (recursive) and 3 (ternary).
Relationship:Mapping Cardinality“Cardinality” indicates the entityoccurrences (instances) participating in arelationship.takes values “one” or “many”.e.g. a one:many relationship indicates that forevery occurrence of one entity, there are manyrelated instances of the other entity. works_ EMPLOYEE DEPARTMENT for
One-to-One (1:1) Staff Branch ManagesstaffNo 1..1 0..1 branchNo“Each branch is managed by “A member of staff can manage zero or one branch”One member of the staff”
One-to-Many (1:*) Staff PropertyForRent OverseesstaffNo 0..1 0..* propertyNo“Each properity for rent is “Each member of staffoverseen by zero or one oversees zero or moremember of staff” properitys for rent”
Many-to-Many (*:*) Newspaper PropertyForRent AdvertisesnewspaperName 0..* 1..* propertyNo“Each properity for rent is “Each newspaper advertisesadvertised in zero or more one or more properties fornewspapers” rent”
Building the ER Modelthe requirements specification is the first step toany design; it captures the ‘what’ of the businessenvironment.also documents the “business rules” - i.e., theconstraints that will apply to your database.e.g. every department must have a manager; and only one manager.the ER model must capture the participatingentities as well as these business rules.
Entity : Categorisation Fundamental/strong entity an entity that is capable of its “own existence” - i.e. an entity whose instances exist notwithstanding the existence of other entities. Weak Entities Associative Entities
Entity types : Weak an entity that is not capable of “its own existence”. characterised by the need to have at least one external identifier (of another entity) as part of its own identifier. e.g. consider “ payment” and “ pmt_items” “ pmt_items” cannot exist without a corresponding “ payment” instance. “pmt_id” of “ payment” will be part of the identifier of “ pmt_items”
Entity types : Associative a relationship translates into migration of a key - many:many relationship implies the keys migrating many times, both ways. such migration leads to redundancy and many:many relationships must therefore be resolved. “Associative entity” is an entity that is used to resolve a many:many relationship.
Summary Entities & Relationships Building an Entity-Relationship model Attributes and Identifiers Cardinality, Degree, Existence of Relationships