0% found this document useful (0 votes)
32 views

02 Database Design ER Model

The document discusses database design using the Entity-Relationship (ER) model. It describes the six steps of database design and defines key concepts in ER modeling like entities, attributes, relationships, and relationship sets. It also covers advanced ER features such as specialization, generalization, keys, and constraints. The document explains how to translate an ER diagram into logical relational tables and the process of normalization.

Uploaded by

Unyil Persi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

02 Database Design ER Model

The document discusses database design using the Entity-Relationship (ER) model. It describes the six steps of database design and defines key concepts in ER modeling like entities, attributes, relationships, and relationship sets. It also covers advanced ER features such as specialization, generalization, keys, and constraints. The document explains how to translate an ER diagram into logical relational tables and the process of normalization.

Uploaded by

Unyil Persi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Computer Science, University of Brawijaya

Putra Pandu Adikara, S.Kom

Database Design & ER Diagrams


Basis Data 2

ER, Relational Model

Database Design
The database design process can be divided into six steps. The ER model is most relevant to the first three steps.
1. Requirements Analysis 2. Conceptual Database Design 3. Logical Database Design

The remaining three steps of database design 4. Schema Refinement 5. Physical Database Design 6. Application and Security Design

Entities, Attributes, And Entity Sets


An entity is an object in the real world that is distinguishable from other objects It is often useful to identify a collection of similar entities. Such a collection is called an entity set An entity is described using a set of attributes. All entities in a given entity set have the same attributes; this is what we mean by similar.
For each attribute associated with an entity set, we must identify a domain of possible values derived attribute can be obtained from other attributes or related entities Weak and Strong Entity is

Relationships And Relationship Sets


A relationship is an association among two or more entities. Set of similar relationships is called relationship set. A relationship set can be thought of as a set of n-tuples: A relationship can also have descriptive attributes used to record information about the relationship

Additional Features Of The ER Model


Key Constraints statement that a certain minimal subset of the fields of a relation is a unique identifier for a tuple A set of fields that uniquely identifies a tuple according to a key constraint is called a candidate key for the relation; we often abbreviate this to just key Sometimes the information stored in a relation is linked to the information stored in another relation thats why we need Foreign Key.
The foreign key in the referencing relation must match the primary key of the referenced relation, that is must have the same number of columns and compatible data types

Cardinality Constraints
Cardinality of relationship
One to one One to many Many to many

Participation Constraints

Participation Constraints

Additional Features Of The ER Model


Weak Entities Class Hierarchies

Enhanced ER Models (EER)


Semantic modelling concepts (abstraction)
Specialisation Generalisation Classification/Categorisation Aggregation

First we need some new entity constructs.


Superclass - an entity type that includes distinct subclasses that require to be represented in a data model. Subclass - an entity type that has a distinct role and is also a member of a superclass.

Specialisation
This is the process of maximising the differences between members of an entity by identifying their distinguishing characteristics.

Here we have shown that the manages relationship is only applicable to the Manager subclass, whereas the works_for relationship is applicable to all staff. It is possible to have subclasses of subclasses.

Generalisation
Generalisation is the process of minimising the differences between entities by identifying common features. This is the identification of a generalised superclass from the original subclasses. This is the process of identifying the common attributes and relationships. For instance, taking:
car(regno,colour,make,model,numSeats) motorbike(regno,colour,make,model,hasWindshield)

And forming:
vehicle(regno,colour,make,model,numSeats,hasWindshielf)

Categorisation ? Aggregation ?

Conceptual Design With The ER Model


Entity versus Attribute Entity versus Relationship Binary versus Ternary Relationships Aggregation versus Ternary Relationships

Integrity Constraints Over Relations


Key Constraints
Which one is the primary key used in the table

Foreign Key Constraints


Which one is the foreign key to refer to another table

General Constraints
The domain in the attribute

Enforcing Integrity Constraints


Insert if not exists in referenced table, reject the insertion Delete can be one of the options:
Delete all rows in referenced table Disallow deletion Set the primary key to the existing default row Set the primary key to null

Update same as previous

Enforcing Integrity Constraints


CREATE TABLE Enrolled ( studid CHAR(20) ,cid CHAR(20) , grade CHAR(10), PRIMARY KEY (studid, dd), FOREIGN KEY (studid) REFERENCES Students ON DELETE CASCADE ON UPDATE NO ACTION) CASCADE , if a Students row is deleted, all rows that refer to it are to be deleted as well ON DELETE SET DEFAULT set to default as defined in default value constraint

Logical Database Design: ER to Relational


Entity Sets to Tables Relationship Sets (without Constraints) to Tables Translating Relationship Sets with Key Constraints Translating Relationship Sets with Participation Constraints Translating Weak Entity Sets Translating Class Hierarchies Translating ER Diagrams with Aggregation

Normalization

Schema Refinement
Why do we need decomposition? What is Functional Dependency (FD)? Normal forms
1NF 2NF 3NF Boyce-Codd (BCNF) 4NF 5NF

You might also like