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

Relational Database Management System (RDMS)

The document discusses relational database management systems (RDBMS) and related concepts such as normalization. It provides information on key aspects of RDBMS including that data is represented in rows and columns of tables, it addresses all types of relations, and supports integrity constraints. The document also covers normalization forms including 1NF, 2NF, 3NF which are achieved through decomposition of relations to remove anomalies from data updates, inserts and deletes. Functional dependencies are also discussed as they relate to normalization.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Relational Database Management System (RDMS)

The document discusses relational database management systems (RDBMS) and related concepts such as normalization. It provides information on key aspects of RDBMS including that data is represented in rows and columns of tables, it addresses all types of relations, and supports integrity constraints. The document also covers normalization forms including 1NF, 2NF, 3NF which are achieved through decomposition of relations to remove anomalies from data updates, inserts and deletes. Functional dependencies are also discussed as they relate to normalization.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

RELATIONAL DATABASE

MANAGEMENT
SYSTEM(RDMS)

By - Piyush Kumar Pareek


RDBMS
• Based on Relational Mathematics
principles
• Data is represented in terms of rows and
columns of a table
• Addresses all types of relations
• Easy to design
• No anomalies for insert/delete/update
RELATIONAL TERMINOLOGY
Tuple (Row)
Attribute (Column)
Relation (Table)

Integrity Constraints
Primary Key
Foreign Key
NORMALIZATION
• Normalization - process of removing data
redundancy by decomposing relations in a
Database.

• De normalization - carefully introduced


redundancy to improve query
performance.
Normalization through
decomposition
• The decomposition approach starts with
one relation and the relation is
decomposed into more number of
relations to remove insert, delete and
update anomalies.

• 1NF, 2NF, 3NF and BCNF can be


achieved by this approach.
First Normal Form
A Relation is said to be in First Normal
Form (1 NF) if the values of each attribute
of the relation are atomic. In other words,
only one value is associated with each
attribute and the value is not a set or a list
of values.
FIRST NORMAL FORM

S# STATUS CITY P# QTY

S1 20 London P1 300
S1 20 London P2 200
S1 20 London P3 400
S1 20 London P4 200
S1 20 London P5 100
S1 20 London P6 100
S2 10 Paris P1 300
S2 10 Paris P2 400
S3 10 Paris P2 200
S4 20 London P2 200
S4 20 London P4 300
S4 20 London P5 400
Functional Dependency
Given a relation R, attribute Y of R is
functionally dependent on attribute X if and
only if each X-value in R has associated
with it precisely one Y-value in R (at any
one time)
Second Normal Form
A relation R is in Second Normal Form (2
NF) if it is in the 1NF and every non key
attribute is full functionally dependent on
the primary key.
Third Normal Form

A relation R is in Third Normal Form (3 NF)


if and only if it is in the 2NF and every non-
key attribute is
non-transitively dependent on the primary
key.
Structured Query Language
– DDL – Data Definition Language
– DML – Data Manipulation language
– DCL – Data Control Language
DDL
• Create
• Alter
• Drop
• Truncate
DML
• Insert
• Update
• Delete
• Select
DCL
• Commit
• Rollback
• Save point
• Set transaction
INTEGRITY CONSTRAINTS
• Primary key (PK)
• Foreign Key (FK)
• Unique key (UK)
• Not Null
• Check
DATA TYPES
• Character
• Varchar2
• Number
• Date
• BLOB
• BFILE
ARITHMETIC OPERATOR
• +
• -
• *
• /
• Mod
• ABS
LOGICAL OPERATIONS
• AND
• OR
• IN
• NOT IN
• <
• >
• <=
• >=
• <>
• BETWEEN
Set Operators
• UNION
• UNION ALL
• INTERSECTION
• MINUS
Where are RDBMS used ?
• Backend for traditional “database”
applications
– EPFL administration
• Backend for large Websites
– Immosearch
• Backend for Web services
– Amazon
FEATURES
– Size of semantic data grows really fast.
– RDBMS has transaction, recovery, replication,
security, …
– RDBMS is efficient in processing queries.
Normalization
The Purpose of Normalization

Normalization is a technique for producing a set of


relations with desirable properties, given the data
requirements of an enterprise.

The process of normalization is a formal method that


identifies relations based on their primary or candidate
keys and the functional dependencies among their
attributes.
Update Anomalies

Relations that have redundant data may have


problems called update anomalies, which are
classified as ,
Insertion anomalies
Deletion anomalies
Modification anomalies
Example of Update Anomalies

To insert a new staff with branchNo B007 into the StaffBranch


relation;
To delete a tuple that represents the last member of staff
located at a branch B007;
To change the address of branch B003.
StaffBranch
staffNo sName position salary branchNo bAddress
SL21 John White Manager 30000 B005 22 Deer Rd, London
SG37 Ann Beech Assistant 12000 B003 163 Main St,Glasgow
SG14 David Ford Supervisor 18000 B003 163 Main St,Glasgow
SA9 Mary Howe Assistant 9000 B007 16 Argyll St, Aberdeen
SG5 Susan Brand Manager 24000 B003 163 Main St,Glasgow
SL41 Julie Lee Assistant 9000 B005 22 Deer Rd, London

Figure 1 StraffBranch relation


Functional Dependencies
Functional dependency describes the relationship between
attributes in a relation.
For example, if A and B are attributes of relation R, and B is
functionally dependent on A ( denoted A B), if each value of
A is associated with exactly one value of B. ( A and B may
each
consist of one or more attributes.)
B is functionally
A B
dependent on A

Determinant Refers to the attribute or group of attributes on the left-


hand side of the arrow of a functional dependency
The Process of Normalization

• Normalization is often executed as a series of steps. Each step


corresponds to a specific normal form that has known properties.

• As normalization proceeds, the relations become progressively


more restricted in format, and also less vulnerable to update
anomalies.

• For the relational data model, it is important to recognize that


it is only first normal form (1NF) that is critical in creating
relations. All the subsequent normal forms are optional.
First Normal Form (1NF)
Repeating group = (propertyNo, pAddress,
rentStart, rentFinish, rent, ownerNo, oName)
Unnormalized form (UNF)
A table that contains one or more repeating groups.

ClientNo cName propertyNo pAddress rentStart rentFinish rent ownerNo oName


6 lawrence Tina
1-Jul-00 31-Aug-01 350 CO40 Murphy
PG4 St,Glasgow
John
CR76
kay Tony
PG16 5 Novar Dr, Shaw
1-Sep-02 1-Sep-02 450 CO93
Glasgow

6 lawrence Tina
PG4 1-Sep-99 10-Jun-00 350 CO40 Murphy
St,Glasgow

Tony
Aline 2 Manor Rd,
CR56 PG36 10-Oct-00 1-Dec-01 370 CO93 Shaw
Stewart Glasgow

Tony
5 Novar Dr, Shaw
PG16 1-Nov-02 1-Aug-03 450 CO93
Glasgow

Figure 3 ClientRental unnormalized table


Definition of 1NF

First Normal Form is a relation in which the intersection of each


row and column contains one and only one value.

There are two approaches to removing repeating groups from


unnormalized tables:

1. Removes the repeating groups by entering appropriate data


in the empty columns of rows containing the repeating data.

2. Removes the repeating group by placing the repeating data,


along with a copy of the original key attribute(s), in a separate
relation. A primary key is identified for the new relation.
1NF ClientRental relation with the first
approach

The ClientRental relation is defined as follows,


With the first
ClientRental approach,
( clientNo, we remove
propertyNo, the repeating
cName, pAddress, group
rentStart, rentFinish, rent,
(property rented
ownerNo, details) by entering the appropriate client
oName)
data into each row.
ClientNo propertyNo cName pAddress rentStart rentFinish rent ownerNo oName
John 6 lawrence Tina
CR76 PG4 1-Jul-00 31-Aug-01 350 CO40
Kay St,Glasgow Murphy
John 5 Novar Dr, Tony
CR76 PG16 1-Sep-02 1-Sep-02 450 CO93
Kay Glasgow Shaw
Aline 6 lawrence Tina
CR56 PG4 1-Sep-99 10-Jun-00 350 CO40
Stewart St,Glasgow Murphy
Tony
Aline 2 Manor Rd,
CR56 PG36 10-Oct-00 1-Dec-01 370 CO93 Shaw
Stewart Glasgow
Tony
Aline 5 Novar Dr,
CR56 PG16 1-Nov-02 1-Aug-03 450 CO93 Shaw
Stewart Glasgow

Figure 4 1NF ClientRental relation with the first approach


1NF ClientRental relation with the second
approach

Client (clientNo,
With the second approach, cName) the repeating group
we remove
PropertyRentalOwner (clientNo, propertyNo, pAddress, rentStart,
(property rented details) by placing the repeating data along with
rentFinish, rent, ownerNo, oName)
aClientNo
copy ofcName
the original key attribute (clientNo) in a separte relation.
CR76 John Kay
CR56 Aline Stewart

ClientNo propertyNo pAddress rentStart rentFinish rent ownerNo oName


6 lawrence Tina
CR76 PG4 1-Jul-00 31-Aug-01 350 CO40
St,Glasgow Murphy
5 Novar Dr, Tony
CR76 PG16 1-Sep-02 1-Sep-02 450 CO93
Glasgow Shaw
6 lawrence Tina
CR56 PG4 1-Sep-99 10-Jun-00 350 CO40
St,Glasgow Murphy
2 Manor Rd, Tony
CR56 PG36 10-Oct-00 1-Dec-01 370 CO93
Glasgow Shaw
5 Novar Dr, Tony
CR56 PG16 1-Nov-02 1-Aug-03 450 CO93
Glasgow Shaw

Figure 5 1NF ClientRental relation with the second approach


Full functional dependency

Full functional dependency indicates that if A and B are


attributes of a relation, B is fully functionally dependent on
A if B is functionally dependent on A, but not on any proper
subset of A.

A functional dependency AB is partially dependent if there


is some attributes that can be removed from A and the
dependency still holds.
Second Normal Form (2NF)

Second normal form (2NF) is a relation that is in first


normal form and every non-primary-key attribute is fully
functionally dependent on the primary key.

The normalization of 1NF relations to 2NF involves the


removal of partial dependencies. If a partial dependency
exists, we remove the function dependent attributes from
the relation by placing them in a new relation along with
a copy of their determinant.
2NF ClientRental relation

The ClientRental relation has the following functional


dependencies:

fd1 clientNo, propertyNo  rentStart, rentFinish (Primary Key)


fd2 clientNo  cName (Partial dependency)
fd3 propertyNo  pAddress, rent, ownerNo, oName (Partial dependency)
fd4 ownerNo  oName (Transitive Dependency)
fd5 clientNo, rentStart  propertyNo, pAddress,
rentFinish, rent, ownerNo, oName (Candidate key)
fd6 propertyNo, rentStart  clientNo, cName, rentFinish (Candidate key)
2NF ClientRental relation

After
Clientremoving the partial dependencies,
(clientNo, cName) the creation of the three
new relations called
Rental Client, Rental,
(clientNo, and PropertyOwner
propertyNo, rentStart, rentFinish)
PropertyOwner (propertyNo, pAddress, rent, ownerNo, oName)
Client Rental
ClientNo cName ClientNo propertyNo rentStart rentFinish
CR76 John Kay CR76 PG4 1-Jul-00 31-Aug-01
CR56 Aline Stewart CR76 PG16 1-Sep-02 1-Sep-02
CR56 PG4 1-Sep-99 10-Jun-00
CR56 PG36 10-Oct-00 1-Dec-01
CR56 PG16 1-Nov-02 1-Aug-03
PropertyOwner

propertyNo pAddress rent ownerNo oName


PG4 6 lawrence St,Glasgow 350 CO40 Tina Murphy

PG16 5 Novar Dr, Glasgow 450 CO93 Tony Shaw

PG36 2 Manor Rd, Glasgow 370 CO93 Tony Shaw

Figure 6 2NF ClientRental relation


Third Normal Form (3NF)

Transitive dependency
A condition where A, B, and C are attributes of a relation such that
if A  B and B  C, then C is transitively dependent on A via B
(provided that A is not functionally dependent on B or C).
Third normal form (3NF)
A relation that is in first and second normal form, and in which
no non-primary-key attribute is transitively dependent on the
primary key.

The normalization of 2NF relations to 3NF involves the removal


of transitive dependencies by placing the attribute(s) in a new
relation along with a copy of the determinant.
3NF ClientRental relation

The functional dependencies for the Client, Rental and


PropertyOwner relations are as follows:

Client
fd2 clientNo  cName (Primary Key)

Rental
fd1 clientNo, propertyNo  rentStart, rentFinish (Primary Key)
fd5 clientNo, rentStart  propertyNo, rentFinish (Candidate key)
fd6 propertyNo, rentStart  clientNo, rentFinish (Candidate key)

PropertyOwner
fd3 propertyNo  pAddress, rent, ownerNo, oName (Primary Key)
fd4 ownerNo  oName (Transitive Dependency)
3NF ClientRental relation

The resulting 3NF relations have the forms:

Client (clientNo, cName)


Rental (clientNo, propertyNo, rentStart, rentFinish)
PropertyOwner (propertyNo, pAddress, rent, ownerNo)
Owner (ownerNo, oName)
3NF ClientRental relation

Client Rental

ClientNo cName ClientNo propertyNo rentStart rentFinish


CR76 John Kay CR76 PG4 1-Jul-00 31-Aug-01
CR56 Aline Stewart CR76 PG16 1-Sep-02 1-Sep-02
CR56 PG4 1-Sep-99 10-Jun-00
CR56 PG36 10-Oct-00 1-Dec-01
CR56 PG16 1-Nov-02 1-Aug-03

PropertyOwner Owner

propertyNo pAddress rent ownerNo ownerNo oName

PG4 6 lawrence St,Glasgow 350 CO40 CO40 Tina Murphy

PG16 5 Novar Dr, Glasgow 450 CO93 CO93 Tony Shaw

PG36 2 Manor Rd, Glasgow 370 CO93

Figure 7 2NF ClientRental relation


• “Aum sai ram”

THANKS . . .

You might also like