Presentation is loading. Please wait.

Presentation is loading. Please wait.

Db design / ER Modeling 20031 319B Database Systems Database Design Wilhelm Steinbuss Room G2.04, ext 4052

Similar presentations


Presentation on theme: "Db design / ER Modeling 20031 319B Database Systems Database Design Wilhelm Steinbuss Room G2.04, ext 4052"— Presentation transcript:

1 db design / ER Modeling 20031 319B Database Systems Database Design Wilhelm Steinbuss Room G2.04, ext 4052 steinbus@cs.waikato.ac.nz

2 db design / ER Modeling 20032 Database Design Conceptual Modeling (Entity Relationship Approach) –What are the entities and relationships in the enterprise? –What information (attributes) about these entities and relationships should we store in the database? Normalization (1NF,2NF,3NF,BCNF,4NF,5NF) check model for redundancies and related anomalies –Reducing the need for additional integrity constraints –The rules behind the common sense in finding the ‚best‘ assignment for the attributes Physical design (Implementation, Tuning) map the model to the features of the target dbms

3 db design / ER Modeling 20033 1. Introduction 1.1 Conceptual Design Why ER-Modeling? –a picture tells you more than 1000 words (ex.1) –hints for additional integrity constraints (ex.2) –independent of technical restrictions (ex.3) More transferable (between releases, vendors) More stable („essential model“)

4 db design / ER Modeling 20034 1.2 Normalization Why normalization ? Suppose table project is a result of conceptional design: employeenumber (A) departmentnumber (B) managernumber (C) projectnumber (unique within manager) (D) departmentname (E) percentage_project_time (F) (allocated by the specified manager) Functional dependency (e.g. B E) implies an integrity constraint !

5 db design / ER Modeling 20035 Integrity constraints Not null Primary key Unique constraint Foreign key Check constraint Trigger Example 5 emp table: Empno number(4) Enamevarchar(10) Jobvarchar(9) Mgrnumber(4) Hiredatedate Salnumber(7,2) Commnumber(7,2) Deptnonumber(2) Email_idvarchar(30)

6 db design / ER Modeling 20036 1.3 Physical design Example 3: a Person owns at least one address an address is assigned to at least one person Possible Implementations: –First address within person table –DEFERRABLE constraints –Nested table

7 db design / ER Modeling 20037 2. Entity Relationship Notation An information system contains all facts which are important for the enterprise Within a fact you assign attribute values to something Example: the person Linda McGee has the birthday 8.3.1952 The saving account 123 has the interest rate 3%

8 db design / ER Modeling 20038 2.1 Entity Everything you want to talk about (assign attribute values) is called an entity Examples: The person Linda McGee The saving account 123

9 db design / ER Modeling 20039 2.2 Entity Type An entity type is a set of entities with the same semantic meaning An entity type is called fundamental if in the fact is only one object involved; it is graphically represented by a rectangle Example:

10 db design / ER Modeling 200310 2.3 associative entity type An entity type is called associative if the fact is a statement about more than one objects; it is graphically represented by a rectangle and arrows pointing to the entity types which are referenced Example:

11 db design / ER Modeling 200311 Example: loan account A person could have more than one account An account is owned by at least one person For each account there have to be at least one security (the security owner must not be the owner of the account)

12 db design / ER Modeling 200312 Solution

13 db design / ER Modeling 200313 Solution (cont.) Additional requests: A security could hedge more than one account A person could own more than one security A security must be assigned to at least one person

14 db design / ER Modeling 200314 Exercise: Doctor’s practice A doctor’s practice want to store information about their patients over time ( e.g. blood sugar, blood pressure, cholesterol) A patient can have different blood values A blood value for a patient could be recorded more than once over time A patient could be treated with drugs. The time period and the dose of a drug should be recorded for a patient Within different time periods there are different dose rates (and a drug changes) possible. Add additional requirements if necessary.

15 db design / ER Modeling 200315 2.4 Attribute type Every attribute type has assigned a type (abstract data type) A type is a set of values together with a set of operations (not very good supported in dbms today; what a sense does it make to multiply two employeenumbers?) (the domain construct is usually only a restriction of a basic type)


Download ppt "Db design / ER Modeling 20031 319B Database Systems Database Design Wilhelm Steinbuss Room G2.04, ext 4052"

Similar presentations


Ads by Google