FEN Conceptual modelling: The Entity-Relation (ER) Model Conceptual models Entity – Relation (ER) models
…or… Where does all the tables come from??? FEN
Conceptual Data Models A conceptual data model describes the data objects (entities) and their relations in the problem domain. A conceptual model of the data is the basis on which the IT systems of an organisation are based. It should be: Independent of implementation Stable over time Over time conceptual data structure doesn't change nearly as much as functionality Conceptual models are to be transformed to a database model as the relational model. FEN
Example: MiniBank This is implementation: FEN What would a conceptual model look like? Entities? Customer Account Relations: Customer-Owns-Account CustomerAccount custNo name accNo balance inRate Owns 1 n
Entity-Relation (ER) Model: Concepts Entities Attributes ⋅ Atomic ⋅ Composite ⋅ Multi valued Attribute values Entity types Keys Domains FEN Relations Cardinality ratio Participation (total / partial) Relations may have attributes Weak Entity Types Identifying owner Identifying relation Partial key A weak entity always has total participation in the identifying relation. CustomerAccount custNo name accNo balance inRate Owns 1 n
Example: The Company Database (Elmasri) FEN
Entities? FEN Department: name(kk), number(kk), location Project: name(kk), number(kk), location Employee: ssn(kk), bdate, name (poss. composite), sex, address (poss. composite), salary Dependent (weak?): name (partial key), sex, bdate Example: The Company Database (Elmasri)
Relations? FEN Manages Works_For Works_On Dependents_Of Supervision Controls Example: The Company Database (Elmasri)
ER Diagram for the Company Database FEN Example: The Company Database (Elmasri) Note the similarities to UML domain models - more on this later
Relations of Degree > 2 FEN Often causes problem in database design May be transformed to binary relations or entities Not to be considered in this introduction
Example/Exercise (Elmasri) FEN Questions: Can a customer exists without an account? Can an account have more owners? How many branches can account belong to? Can a customer have accounts in more than one branch? …???