110 likes | 202 Views
Seminar: Introduction to relational databases. Introduction to the database field: Conceptual modelling: The Entity-Relation (ER) Model. …or…. Where does all the tables come from???. Conceptual Data Models.
E N D
Seminar:Introduction to relational databases Introduction to the database field: Conceptual modelling:The Entity-Relation (ER) Model FEN 2012-09-01
…or… Where does all the tables come from??? FEN 2012-09-01
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 2012-09-01
Example: MiniBank What would a conceptual model look like? • Entities? • Customer • Account • Relations: • Customer-Owns-Account This is implementation: accNo balance name custNo n 1 Customer Account Owns inRate FEN 2012-09-01
Entity-Relation (ER) Model: Concepts • Relations • Cardinality ratio • Participation (total / partial) • Relations may have attributes • Entities • Attributes • Atomic • Composite • Multi valued • Attribute values • Entity types • Keys • Domains • Weak Entity Types • Identifying owner • Identifying relation • Partial key • A weak entity always has total participation in the identifying relation. accNo balance name custNo n 1 Customer Account Owns inRate FEN 2012-09-01
Example: The Company Database (Elmasri) FEN 2012-09-01
Example: The Company Database (Elmasri) Entities? • 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 FEN 2012-09-01
Example: The Company Database (Elmasri) Relations? • Manages • Works_For • Works_On • Dependents_Of • Supervision • Controls FEN 2012-09-01
Example: The Company Database (Elmasri) ER Diagram for the Company Database FEN 2012-09-01
Relations of Degree > 2 • Often causes problem in database design • May be transformed to binary relations or entities • Not to be considered in this introduction FEN 2012-09-01
Example/Exercise (Elmasri) • 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? • …??? FEN 2012-09-01