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

Chapter 3

database course

Uploaded by

esammagdy789
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter 3

database course

Uploaded by

esammagdy789
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Data Modeling and Normalization

Agenda

❑ Introduction

❑ Data Modeling Concepts

❑ Entity-Relationship Diagramming

❑ ERD components

❑ ERD Symbols & Notations

❑ Types of Data Models

❑ Database normalization
Introduction
❑ Data modeling: the process of analyzing the things of interest to your organization and how these things are related to
each other.

❑ Data modeling asks the question "What?"


Data Modeling Concepts
❑ The goal of a data model is to record the data requirements of a business process.

❑ data model delivers value by enhancing communication and understanding business requirements.

❑ When databases are built from a well-designed data model, the resultant structures provide:

a. increased value to the organization.

b. minimized data redundancy.

c. maximized data integrity.

d. increased stability.

e. better data sharing.

f. increased consistency.

g. better data usability.


Data Modeling Concepts
❑ Building databases from a data model will result in a better database implementation because you will have a better

understanding of the data to be stored in your databases.

❑ Another benefit of data modeling is the opportunity to discover new uses for data. A data model can clarify data

patterns and potential uses for data that might otherwise remain hidden. Discovery of such patterns can change the

way your business operates and can potentially lead to a competitive advantage and increased revenue for your

organization.
ERD Model

❑ ER Model stands for Entity Relationship Model is a high-level conceptual data model diagram. ER model helps to

systematically analyze data requirements to produce a well-designed database.

❑ The ER Model represents real-world entities and the relationships between them.

❑ It is a GUI representation of the logical structure of a Database.


ERD Symbols & Notations

❑ mainly contains three basic symbols which are rectangle, oval and diamond.

❑ Following are the main components and its symbols in ER Diagrams:

a) Rectangles : symbol to represent Entity.

b) Oval : symbol represents attribute .

c) Diamonds : symbol represents relationship between entities.


Entity-Relationship Diagramming
ERD components[Entity]

❑ A real-world thing either living or non-living that is easily recognizable and nonrecognizable that is to be represented
in our database.

❑ An entity can be place, person, object, event or a concept, which stores data in the database.

❑ Examples of entities: Person: Employee, Student.

❑ An entity set is a group of similar kind of entities. It may contain entities with attribute sharing similar values.
Strong Entity vs weak entity
Strong Entity vs weak entity
ERD components [Attributes ]

❑ Attributes are the characteristic properties that define all the items belonging to a specific category.

❑ Types of attributes in DBMS:


ERD components [Attributes ]

❑ simple attributes :Attributes that cannot be further sub-divided into several attributes are called.
ERD components [Attributes ]

❑ Composite Attribute : attributes composed of many other simple attributes.


ERD components [Attributes ]

❑ Single-valued Attribute : attributes are properties that have a single particular value for a particular entity. This means

that single-valued attributes don't have more than one value for an item.
ERD components [Attributes ]

❑ Multi-valued Attribute : Attributes that can have multiple sets of values for a single entity.
ERD components [Attributes ]

❑ Derived/Stored Attributes : attributes can be obtained from processing other attributes.


ERD components [Attributes ]

❑ Complex Attribute : nesting the composite and multi-valued attributes.


ERD components [relationship ]

❑ Relationships define how the different entities are associated with each other.

❑ Types of relationships between 2 entities (cardinality)

1. One-to-One Relationship.

2. One-to-Many or Many-to-One Relationship .

3. Many-to-Many Relationship.
ERD components [relationship ]

❑ Constraints : define the number of instances of an entity participating in the relationship type.

1. Total Participation : entity must participate in a relationship to exist.

2. Partial (optional) participation : entity can exist without participating in a relationship with another entity
ERD components [keys]

❑ keys in DBMS is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table).

❑ They allow you to find the relation between two tables.

❑ Keys help you uniquely identify a row in a table by a combination of one or more columns in that table.

❑ Entity keys can be super, primary and Foreign Keys.


ERD components [primary key]

❑ Each entity will have one, and only one, primary key.

❑ Characteristics of good primary keys include the following:

• The value of any component of the primary key cannot be null.

• It must for every row to have a primary key value.

• Two rows can’t have the same primary key value


ERD components [primary key]
ERD components [Foreign key]

❑ FOREIGN KEY is a column that creates a relationship between two tables.

❑ It acts as a cross-reference between two tables as it references the primary key of another table.
ERD components [Foreign key]
Types of Data Models in DBMS

❑ There are three types of data models:


1. Conceptual Data Model.

2. Logical Data Model.

3. Physical Data Model


Data models [conceptual ]

❑ This Data Model defines WHAT the system contains.

❑ The purpose of creating a conceptual data model is to establish entities, their attributes, and relationships.

❑ Business stakeholders and data architects typically create a conceptual data model.
Data models [logical ]

❑ logical data model is constructed by taking the data descriptions depicted in a conceptual data model and introducing
associated elements, definitions and greater context for the data’s structure.

❑ detail includes defining the owned attributes, primary keys, foreign keys, relationship cardinality and describing
entities and classes.
Data models [physical ]

❑ A physical data model is a framework or schema that describes how data is actually kept in a database.

❑ The physical data model is created to transform the logical data model into a physical implementation using a specific

DBMS product such as DB2, Oracle, or SQL Server.


Data models [summary ]
Data models types [summary ]
Database normalization

❑ Normalization is a database design technique that reduces data redundancy and eliminates undesirable characteristics
like Insertion, Update and Deletion Anomalies.

❑ Normalization rules divides larger tables into smaller tables and links them using relationships.

❑ Database Normal Forms:

1) 1NF (First Normal Form)

2) 2NF (Second Normal Form)

3) 3NF (Third Normal Form)

4) BCNF (Boyce-Codd Normal Form)

5) 4NF (Fourth Normal Form)

6) 5NF (Fifth Normal Form)


Database normalization
Database normalization

❑ Prime attribute : An attribute that is member of the primary key

❑ Non Prime attribute : An attribute that is not member of the primary key .
Database normalization [First Normal Form]

❑ All columns of a table must have a single atomic value in each row of a table.

❑ Each row of a table should have an unique identifier to uniquely identify the rows of the table .
Database normalization [First Normal Form]
❑ All columns of a table must have a single atomic value in each row of a table.

❑ Each row of a table should have an unique identifier to uniquely identify the rows of the table .
Database normalization [second Normal Form]

❑ The table must satisfy all the conditions of 1NF.

❑ attributes of each entity are dependent on the primary key.


Database normalization [third Normal Form]

❑ The table must satisfy all the conditions of 2NF.

❑ All attributes determined only by the key. (Does not have transitive dependency).

You might also like