Unit II Dbms
Unit II Dbms
DATABASE DESIGN
Entity-Relationship model
E-R diagram can express the overall logical structure of a
database graphically
Entity sets
Attributes
Entity set
Entity:
- a “thing” or “object” in the real world that is distinguishable
from all other objects.
An entity has a set of properties, and the values for some set of
properties must uniquely identify an entity
Entity
Attributes
Entities are represented by means of their properties,
called attributes.
4) Multi-value attribute
Multi-value attributes may contain more than one
values.
For example, a person can have more than one
phone number, email_address, etc.
Entity-Set and Keys
1) Unary Relationship –
3) Ternary (degree 3)
Weak Entity:
The weak entity in DBMS do not have a primary key and are
dependent on the parent entity. It mainly depends on other
entities.
Weak Entity is represented by double rectangle −
Your Text Here
Normalization
“Good Database”
A technique of organizing the data into multiple related
tables, to minimize Data Redundancy
Normalization is the process of organizing the data in the
database.
Step 1 of Normalization:
In DB, we often have the case where one field defines
the other.
X Y
“X determines Y” or “ X is Functionally dependent on Y”
Marks Grade
It
typically exists between the primary key and non-
key attribute within a table.
StudentID ProjectID StudentName ProjectName
ProjectID ProjectName
Primary key
{Student ID, ProjectID} Primary key
it is in 2NF and
not contain any transitive partial dependency
Primary key or
prime attribute
X Y
Functional Dependency
X Y
Partial Functional
Dependency
X Y
BCNF
SUPER KEY
Boyce codd Normal Form(BCNF)
OR
3.5 Normal Form
Break down
R1 R2
Join again
R
Get the same relation again
AGENT COMPANY PRODUCT
A CAR
A TRUCK
A CAR
A TRUCK
B CAR
AGENT COMPANY PRODUCT
A FORD CAR
A FORD TRUCK
A GM CAR
A GM TRUCK
B FORD CAR
AGENT COMPANY COMPANY PRODUCT
A FORD FORD CAR
A GM FORD TRUCK
GM CAR
B FORD
GM TRUCK
AGENT PRODUCT
A CAR
A TRUCK
B CAR
R1 R2 R3
COMPA PRODU
AGENT COMPANY NY CT AGENT PRODUCT
A FORD A CAR
FORD CAR
A GM A TRUCK
FORD TRUCK
B FORD B CAR
GM CAR
GM TRUCK
GM
A TRUCK
FORD
B CAR