0% found this document useful (0 votes)
134 views32 pages

Database Design Theory

This document discusses key concepts in database design theory including entities, entity sets, attributes, relationships, and dependencies. It defines entities and examples of different entity types. It describes strong and weak entity sets and their characteristics. It also explains attribute types, degrees of relationships, mapping cardinalities for one-to-one, one-to-many, and many-to-many relationships. Additionally, it discusses the differences between primary keys and foreign keys and types of dependencies.

Uploaded by

Hidayah Sanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views32 pages

Database Design Theory

This document discusses key concepts in database design theory including entities, entity sets, attributes, relationships, and dependencies. It defines entities and examples of different entity types. It describes strong and weak entity sets and their characteristics. It also explains attribute types, degrees of relationships, mapping cardinalities for one-to-one, one-to-many, and many-to-many relationships. Additionally, it discusses the differences between primary keys and foreign keys and types of dependencies.

Uploaded by

Hidayah Sanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

STM10163

DATABASE FUNDAMENTALS
TOPIC 2 - DATABASE DESIGN THEORY
Entity
• An entity set is a set of same type of entities.
Entity Examples
Person EMPLOYEE, STUDENT, PATIENT
Place STORE, WAREHOUSE
Object MACHINE, PRODUCT, CAR
Event SALE,REGISTRATION, RENEWAL
Concept ACCOUNT, COURSE
Types of Entity Sets
• An entity set may be of the following two types-
1. Strong Entity Set
• A strong entity set is an entity set that contains sufficient attributes
to uniquely identify all its entities.
• In other words, a primary key exists for a strong entity set.
• Primary key of a strong entity set is represented by underlining it.
2. Weak Entity Set
• A weak entity set is an entity set that does not contain sufficient
attributes to uniquely identify its entities.
• In other words, a primary key does not exist for a weak entity set.
• However, it contains a partial key called as a discriminator.
• Discriminator can identify a group of entities from the entity set.
• Discriminator is represented by underlining with a dashed line.
Example of Entity
Differences between Strong entity set and
Weak entity set-
Strong entity set Weak entity set

A single rectangle is used for the A double rectangle is used for the
representation of a strong entity set. representation of a weak entity set.
It contains sufficient attributes to form its It does not contain sufficient attributes to
primary key. form its primary key.
A double diamond symbol is used for the
A diamond symbol is used for the
representation of the identifying relationship
representation of the relationship that exists
that exists between the strong and weak entity
between the two strong entity sets.
set.

A single line is used for the representation of A double line is used for the representation
the connection between the strong entity set of the connection between the weak entity
and the relationship. set and the relationship set.

Total participation may or may not exist in Total participation always exists in the
the relationship. identifying relationship
Important Note
• Weak entity set is always present in total participation with the
identifying relationship set.
Attributes
• Attributes are associated with an entity set.
• Attributes describe the properties of entities in the entity set.
• Based on the values of certain attributes, an entity can be identified
uniquely.
Types of Attributes

• In ER diagram, attributes associated with an entity set may be of the


following types-
1. Simple Attributes
• Simple attributes are those attributes which can not be divided further.
2. Composite Attributes
• Composite attributes are those attributes which are composed of many other
simple attributes. The attributes “Name” and “Address” are composite attributes
as they are composed of many other simple attributes.
3. Single Valued Attributes
• Single valued attributes are those attributes which can take only one value for
a given entity from an entity set. All the attributes are single valued attributes
as they can take only one specific value for each entity.
4. Multi Valued Attributes
• Multi valued attributes are those attributes which can take more than one
value for a given entity from an entity set. The attributes “Mob_no” and
“Email_id” are multi valued attributes as they can take more than one values
for a given entity.
5. Derived Attributes
• Derived attributes are those attributes which can be derived from other attribute(s).
The attribute “Age” is a derived attribute as it can be derived from the attribute
“DOB”.
6. Key Attributes
• Key attributes are those attributes which can identify an entity uniquely in an
entity set. The attribute “Roll_no” is a key attribute as it can identify any
student uniquely.
Relationship
• Association among two or more entities
• Given a name that describes its function.
• Relationship name is an active or a passive verb
Degree of Relationships
• Degree: number of entity types that participate in a relationship
• On the basis of degree of a relationship set, a relationship set can
be classified into the following types-
1. Unary Relationship Set
• Unary relationship set is a relationship set where only one entity set
participates in a relationship set.
• Example- One person is married to only one person
2. Binary Relationship Set
• Binary relationship set is a relationship set where two entity sets
participate in a relationship set.
• Example- Student is enrolled in a Course
3. Ternary Relationship Set
• Ternary relationship set is a relationship set where three entity sets
participate in a relationship set.
• Example-
Mapping Cardinalities
• Mapping cardinalities define the number of association
between two entities.
• Cardinalities
• one to one
• one to many
• many to many
One-To-One Relationship
• A one-to-one (1:1) relationship means that each record in Table A relates to
one, and only one, record in Table B, and each record in Table B relates to
one, and only one, record in Table A.

1 1
Personal received Payroll
Each record in the Personal table is about one
employee. That record relates to one, and only
one, record in the Payroll table.

Each record in the Payroll table relates to one,


and only one, record in the Personal table. (This
is what looking at it from both directions
means.)
One-To-Many Relationship
• A one-to-many (1:M) relationship means a record in a row in table A can have
many matching rows in table B, but a row in table B can have only one
matching row in table A.

1 M
Customers makes Orders
The Customers table holds a unique record for each customer. Each
customer can place many orders.

Many records in the Orders table can relate to only one record in the
Customers table. This is a one-to-many relationship (1:M) between the
Customers table and the Orders table.
Many-To-Many Relationship
• In a many-to-many (M:N) relationship, a row in table A can have many
matching rows in table B, and vice versa.

M N
Employees assigned Project
Each project can involve more than one
employee and each employee can be
working on more than one project.

This constitutes a many-to-many (M:N)


relationship.
Difference Between Primary Key and
Foreign Key
Primary Key Foreign Key
Foreign key is a field in the table that is primary
Primary key uniquely identify a record in the table.
key in another table.
Primary Key can't accept null values. Foreign key can accept multiple null value.
We can have only one Primary key in a table. We can have more than one foreign key in a table.
The primary key of a particular table is the attribute The foreign key of a particular table is simply the
which uniquely identifies every record and does not primary key of some other table which is used as a
contain any null value. reference key in the second table.
A primary key attribute in a table can never contain A foreign key attribute may have null values as
a null value. well.
Not more than one primary key is permitted in a A table can have one or more than one foreign key
table. for referential purposes.
Duplicity is strictly prohibited in the primary key; Duplicity is permitted in the foreign key attribute,
there cannot be any duplicate values. hence duplicate values are permitted.
Dependency in Database
• An important concept associated with normalization is functional
dependency which describes the relationship between attributes.
• Functional dependency can be divided into two types:
• Full functional dependency/Partial dependency (PD)
• Will be used to transform 1NF 2NF
• Transitive dependency (TD) •
• Will be used to transform 2NF 3NF
Dependency in Database
• Fully functional dependency - when an non-key attribute is determined by a
whole part of a COMPOSITE primary key.

• Partial Dependency – when an non-key attribute is determined by a part, but


not the whole of a COMPOSITE primary key.

• Transitive Dependency – when a non-key attribute determines another non-


key attribute.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy