0% found this document useful (0 votes)
40 views53 pages

Dbms Unit

Uploaded by

2020pitcse278
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)
40 views53 pages

Dbms Unit

Uploaded by

2020pitcse278
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/ 53

UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

UNIT-2
DATABASE DESIGN
Entity-Relationship model-E-R Diagrams-Enhanced-ER Model-ER-to-Relational Mapping-
Functional Dependencies-Non-Loss Decomposition-First, Second, Third Normal Forms,
Dependency Preservation-Boyce/Codd Normal Form-Multi-Valued Dependencies and Fourth
Normal Form-join Dependencies and Fifth Normal Form.

ENTITY
An entity is an object that exists and is distinguishable from other objects.

Example: specific person, company, event, plant

An entity set is a set of entities of the same type that share the same properties.

Example: set of all persons, companies, trees, holidays

E-R DIAGRAM (ENTITY RELATIONSHIP DIAGRAM)

ER-Diagram is a visual representation of data that describes how data is related to each other.

 E-R Model was proposed by Dr. Peter Chen

 E-R model is graphical in nature, thus making it easy to analyze and Observe relationship
between data elements
 Most DBMS are based upon E-R model
Elements of E-R Model

Data represented graphically via entity-relationship diagram which contains 3 main element
types:

 Entity sets

 Attributes

 Relationships

II YEAR/IV SEM Page 1


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Example: Customer & Loan entity set & its relationship borrower

Modeling

 A database can be modeled as:

 a collection of entities,

 Relationship among entities.

 An entity is an object that exists and is distinguishable from other objects.

 Example: specific person, company, event, plant

 Entities have attributes

 Example: people have names and addresses

 An entity set is a set of entities of the same type that share the same properties.

Example: set of all persons, companies, trees, holidays

Notations:

 Rectangles represent entity sets.

 Diamonds represent relationship sets.

II YEAR/IV SEM Page 2


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 Lines link attributes to entity sets and entity sets to relationship sets.

 Ellipses represent attributes

o Double ellipses represent multivalve attributes.

o Dashed ellipses denote derived attributes.

o Underline indicates primary key attributes

E-R Diagram With Composite, Multivalve, and Derived Attributes

Roles

 Entity sets of a relationship need not be distinct.

 The labels ―manager‖ and ―worker‖ are called roles; they specify how employee entities
interact via the works for relationship set.

 Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to
rectangles.

II YEAR/IV SEM Page 3


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 Role labels are optional, and are used to clarify semantics of the relationship

RELATIONSHIP MODEL/CARDINALITY CONSTRAINTS

 Cardinality constraints by drawing either a directed line (), signifying ―one,‖ or an


undirected line (—), signifying ―many,‖ between the relationship set and the entity set.

One-to-one relationship

one entity from entity set A can be associated with at most one entity of entity set B and
vice versa.

Example:
o A customer is associated with at most one loan via the relationship borrower
o A loan is associated with at most one customer via borrower
One-To-Many Relationship

One entity from entity set A can be associated with more than one entities of entity set B but
from entity set B one entity can be associated with at most one entity.

II YEAR/IV SEM Page 4


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Example:
In the one-to-many relationship a loan is associated with at most one customer via
borrower, a customer is associated with several (including 0) loans via borrower

Many-To-One Relationships

More than one entities from entity set A can be associated with at most one entity of entity set B
but one entity from entity set B can be associated with more than one entity from entity set A.

Example:

In a many-to-one relationship a loan is associated with several (including 0) customers via


borrower, a customer is associated with at most one loan via borrower

II YEAR/IV SEM Page 5


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Many-To-Many Relationship

one entity from A can be associated with more than one entity from B and vice versa.

 A customer is associated with several (possibly 0) loans via borrower

 A loan is associated with several (possibly 0) customers via borrower

Participation of an Entity Set in a Relationship Set

 Total participation (indicated by double line): every entity in the entity set participates
in at least one relationship in the relationship set

II YEAR/IV SEM Page 6


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

o E.g. participation of loan in borrower is total

 every loan must have a customer associated to it via borrower

 Partial participation: some entities may not participate in any relationship in the
relationship set

Example: participation of customer in borrower is partial

E-R DIAGRAM

An Entity Relationship Diagram (ERD) is a visual representation of different entities within a


system and how they relate to each other. For example, the elements writer, novel, and a
consumer may be described using ER diagrams the following way:

ER diagram with basic objects

History of ER Diagrams

Peter Chen is credited with introducing the widely adopted ER model in his paper ―The Entity
Relationship Model-Toward a Unified View of Data‖. His model was inspired by the data

II YEAR/IV SEM Page 7


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

structure diagrams introduced by Charles Bachman. One of the early forms of ER diagrams,
Bachman diagrams are named after him.

ER Diagram Symbols and Notations

Rectangle: Represents Entity sets.

Ellipses: Attributes

Diamonds: Relationship Set

Lines: They link attributes to Entity Sets and Entity sets to Relationship Set

Double Ellipses: Multivalued Attributes

Dashed Ellipses: Derived Attributes

Double Rectangles: Weak Entity Sets

Double Lines: Total participation of an entity in a relationship set

There are three basic elements in an ER Diagram: entity, attribute, relationship. There are more
elements which are based on the main elements. They are weak entity, multi valued attribute,
derived attribute, weak relationship, and recursive relationship. Cardinality and ordinality are
two other notations used in ER diagrams to further define relationships.

II YEAR/IV SEM Page 8


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

How to Draw ER Diagrams

Below points show how to go about creating an ER diagram.

1. Identify all the entities in the system. An entity should appear only once in a particular
diagram. Create rectangles for all entities and name them properly.
2. Identify relationships between entities. Connect them using a line and add a diamond in
the middle describing the relationship.
3. Add attributes for entities. Give meaningful attribute names so they can be understood
easily.

A sample E-R Diagram1:

II YEAR/IV SEM Page 9


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Weak Entity

A weak entity cannot be used independently as it is dependent on a strong entity type known as
its owner entity. Also, the relationship that connects the weak entity to its owner identity is called
the identifying relationship.

A weak entity always has a total participation constraint with respect to its identifying
relationship because it cannot be identified independently of its owner identity.

A weak entity may have a partial key, which is a list of attributes that identify weak entities
related to the same owner entity.

In the ER diagram, both the weak entity and its corresponding relationship are represented using
a double line and the partial key is underlined with a dotted line.

In the given ER diagram, Dependent is the weak entity and it depends on the strong entity
Employee via the relationship Depends on.

There can be an employee without a dependent in the Company but there will be no record of the
Dependent in the company systems unless the dependent is associated with an Employee.

II YEAR/IV SEM Page 10


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

E-R diagram for weak entity set

Strong Entity

A strong entity is complete by itself and is not dependent on any other entity type. It possess a
primary key which describes each instance in the strong entity set uniquely. That means any
element in the strong entity set can be uniquely identified.

A Strong entity is represented by a square with a single line unlike a Weak Entity which
contained double lines.

II YEAR/IV SEM Page 11


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

E-R diagram for Strong Entity set

Difference Between Weak Entity and Strong Entity


Basis for
Strong Entity Weak Entity
Comparison

The Strong entity has a primary The weak entity has a partial discriminator
Basic
key. key.

The Strong entity is independent of Weak entity depends on the strong entity
Depends
any other entity in a schema. for its existence.

Strong entity is denoted by a single Weak entity is denoted with the double
Denoted
rectangle. rectangle.

The relationship between a weak and a


The relation between two strong
strong entity is denoted by Identifying
Relation entities is denoted by a single
Relationship denoted with double
diamond simply called relationship.
diamond.

Strong entity may or may not have Weak entity always has total participation
Participation total participation in the in the identifying relationship shown by
relationship. double line.

II YEAR/IV SEM Page 12


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

ER Diagram for Library Management System

ER DIAGRAM FOR RESTAURANT MENU SYSTEM

Benefits of ER diagrams
First, ER diagrams are easy to understand and do not require a person to undergo extensive
training to be able to work with it efficiently and accurately. This means that designers can use

II YEAR/IV SEM Page 13


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

ER diagrams to easily communicate with developers, customers, and end users, regardless of
their IT proficiency.

Second, ER diagrams are readily translatable into relational tables which can be used to quickly
build databases. In addition, ER diagrams can directly be used by database developers as the
blueprint for implementing data in specific software applications.

Lastly, ER diagrams may be applied in other contexts such as describing the different
relationships and operations within an organization.

ENHANCED ER MODEL (EER MODEL)

EER is a high-level data model that incorporates the extensions to the original ER model.
It is a diagrammatic technique for displaying the following concepts

 Sub Class and Super Class


 Specialization and Generalization
 Union or Category
 Aggregation

These concepts are used when the comes in EER schema and the resulting schema diagrams
called as EER Diagrams.

Features of EER Model

 EER creates a design more accurate to database schemas.


 It reflects the data properties and constraints more precisely.
 It includes all modeling concepts of the ER model.
 Diagrammatic technique helps for displaying the EER schema.
 It includes the concept of specialization and generalization.
 It is used to represent a collection of objects that is union of objects of different of
different entity types.

A. Sub Class and Super Class

II YEAR/IV SEM Page 14


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 Sub class and Super class relationship leads the concept of Inheritance.

 The relationship between sub class and super class is denoted with symbol.

1. Super Class

 Super class is an entity type that has a relationship with one or more subtypes.
 An entity cannot exist in database merely by being member of any super class.
For example: Shape super class is having sub groups as Square, Circle, Triangle.

2. Sub Class

 Sub class is a group of entities with unique attributes.


 Sub class inherits properties and attributes from its super class.
For example: Square, Circle, Triangle are the sub class of Shape super class.

B. Specialization and Generalization

1. Generalization

 Generalization is the process of generalizing the entities which contain the properties of
all the generalized entities.

II YEAR/IV SEM Page 15


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 It is a bottom approach, in which two lower level entities combine to form a higher level
entity.
 Generalization is the reverse process of Specialization.
 It defines a general entity type from a set of specialized entity type.
 It minimizes the difference between the entities by identifying the common features.
For example:

In the above example, Tiger, Lion, Elephant can all be generalized as Animals.

2. Specialization

 Specialization is a process that defines a group entities which is divided into sub groups
based on their characteristic.
 It is a top down approach, in which one higher entity can be broken down into two lower
level entity.
 It maximizes the difference between the members of an entity by identifying the unique
characteristic or attributes of each member.
 It defines one or more sub class for the super class and also forms the superclass/subclass
relationship.

For example

II YEAR/IV SEM Page 16


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

In the above example, Employee can be specialized as Developer or Tester, based on what role
they play in an Organization.

C. Category or Union

 Category represents a single super class or sub class relationship with more than one
super class.
 It can be a total or partial participation.
For example Car booking, Car owner can be a person, a bank (holds a possession on a
Car) or a company. Category (sub class) → Owner is a subset of the union of the three
super classes → Company, Bank, and Person. A Category member must exist in at least
one of its super classes.

D. Aggregation

II YEAR/IV SEM Page 17


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 Aggregation is a process that represent a relationship between a whole object and its
component parts.
 It abstracts a relationship between objects and viewing the relationship as an object.
 It is a process when two entity is treated as a single entity.

In the above example, the relation between College and Course is acting as an Entity in Relation
with Student.

MAPPING ER DIAGRAMS TO RELATIONAL MODEL

FUNCTIONAL DEPENDENCIES

II YEAR/IV SEM Page 18


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Functional dependency (FD) is a set of constraints between two attributes in a relation.


Functional dependency says that if two tuples have same values for attributes A1, A2,..., An,
then those two tuples must have to have same values for attributes B1, B2, ..., Bn.

Functional dependency is represented by an arrow sign (→) that is, X→Y, where X functionally
determines Y. The left-hand side attributes determine the values of attributes on the right-hand
side.

The functional dependency is a relationship that exists between two attributes. It typically exists

between the primary key and non-key attribute within a table.

X → Y

The left side of FD is known as a determinant, the right side of the production is known as a
dependent.

The left side of FD is known as a determinant, the right side of the production is known as a
dependent.

For example:

Assume we have an employee table with attributes: Emp_Id, Emp_Name, Emp_Address.

Here Emp_Id attribute can uniquely identify the Emp_Name attribute of employee table because
if we know the Emp_Id, we can tell that employee name associated with it.

Functional dependency can be written as:

1. Emp_Id → Emp_Name

We can say that Emp_Name is functionally dependent on Emp_Id.

Types of Functional dependency

II YEAR/IV SEM Page 19


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

1. Trivial functional dependency

 A → B has trivial functional dependency if B is a subset of A.


 The following dependencies are also trivial like: A → A, B → B

Example:

1. Consider a table with two columns Employee_Id and Employee_Name.


2. {Employee_id, Employee_Name} → Employee_Id is a trivial functional dependency
as
3. Employee_Id is a subset of {Employee_Id, Employee_Name}.
4. Also, Employee_Id → Employee_Id and Employee_Name → Employee_Name are tri
vial dependencies too.

2. Non-trivial functional dependency

 A → B has a non-trivial functional dependency if B is not a subset of A.


 When A intersection B is NULL, then A → B is called as complete non-trivial.

Example:

1. ID → Name,
2. Name → DOB

II YEAR/IV SEM Page 20


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Armstrong’s Axioms Property of Functional Dependency

Armstrong‘s Axioms property was developed by William Armstrong in 1974 to reason about
functional dependencies.

The property suggests rules that hold true if the following are satisfied:

1. Transitivity
If A->B and B->C, then A->C i.e. a transitive relation.
2. Reflexivity
A-> B, if B is a subset of A.
3. Augmentation
The last rule suggests: AC->BC, if A->B

Multivalued dependency in DBMS

Multivalued dependency occurs when there are more than one independent multivalued
attributes in a table.

For example: Consider a bike manufacture company, which produces two colors (Black and
white) in each model every year.

bike_model manuf_year color

M1001 2007 Black

M1001 2007 Red

M2012 2008 Black

M2012 2008 Red

M2222 2009 Black

II YEAR/IV SEM Page 21


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

M2222 2009 Red

Here columns manuf_year and color are independent of each other and dependent on
bike_model. In this case these two columns are said to be multivalued dependent on bike_model.
These dependencies can be represented like this:

bike_model ->> manuf_year

bike_model ->> color

Transitive dependency in DBMS

A functional dependency is said to be transitive if it is indirectly formed by two functional


dependencies. For e.g.

X -> Z is a transitive dependency if the following three functional dependencies hold true:

 X->Y
 Y does not ->X
 Y->Z

Note: A transitive dependency can only occur in a relation of three of more attributes. This
dependency helps us normalizing the database in 3NF (3rd Normal Form).

Example: Let‘s take an example to understand it better:

Book Author Author_age

Game of Thrones George R. R. Martin 66

Harry Potter J. K. Rowling 49

Dying of the Light George R. R. Martin 66

{Book} ->{Author} (if we know the book, we knows the author name)

II YEAR/IV SEM Page 22


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

{Author} does not ->{Book}

{Author} -> {Author_age}

Therefore as per the rule of transitive dependency: {Book} -> {Author_age} should hold, that
makes sense because if we know the book name we can know the author‘s age.

NON-LOSS DECOMPOSITION

What is decomposition?

 Decomposition is the process of breaking down in parts or elements.


 It replaces a relation with a collection of smaller relations.
 It breaks the table into multiple tables in a database.
 It should always be lossless, because it confirms that the information in the original
relation can be accurately reconstructed based on the decomposed relations.
 If there is no proper decomposition of the relation, then it may lead to problems like loss
of information.

Properties of Decomposition

Following are the properties of Decomposition,


1. Lossless Decomposition
2. Dependency Preservation
3. Lack of Data Redundancy

1. Lossless Decomposition

 Decomposition must be lossless. It means that the information should not get lost from
the relation that is decomposed.
 It gives a guarantee that the join will result in the same relation as it was decomposed.

Example:
Let's take 'E' is the Relational Schema, With instance 'e'; is decomposed into: E1, E2, E3,

II YEAR/IV SEM Page 23


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

. . . . En; With instance: e1, e2, e3, . . . . en, If e1 ⋈ e2 ⋈ e3 . . . . ⋈ en, then it is called as
'Lossless Join Decomposition'.

 In the above example, it means that, if natural joins of all the decomposition give the
original relation, then it is said to be lossless join decomposition.

Example: <Employee_Department> Table

Eid Ename Age City Salary Deptid DeptName

E001 ABC 29 Pune 20000 D001 Finance

E002 PQR 30 Pune 30000 D002 Production

E003 LMN 25 Mumbai 5000 D003 Sales

E004 XYZ 24 Mumbai 4000 D004 Marketing

E005 STU 32 Bangalore 25000 D005 Human Resource

 Decompose the above relation into two relations to check whether a decomposition is
lossless or lossy.
 Now, we have decomposed the relation that is Employee and Department.

Relation 1 : <Employee> Table

Eid Ename Age City Salary

E001 ABC 29 Pune 20000

E002 PQR 30 Pune 30000

E003 LMN 25 Mumbai 5000

E004 XYZ 24 Mumbai 4000

E005 STU 32 Bangalore 25000

 Employee Schema contains (Eid, Ename, Age, City, Salary).

II YEAR/IV SEM Page 24


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Relation 2 : <Department> Table

Deptid Eid DeptName

D001 E001 Finance

D002 E002 Production

D003 E003 Sales

D004 E004 Marketing

D005 E005 Human Resource

 Department Schema contains (Deptid, Eid, DeptName).


 So, the above decomposition is a Lossless Join Decomposition, because the two relations
contains one common field that is 'Eid' and therefore join is possible.
 Now apply natural join on the decomposed relations.

Employee ⋈ Department

Eid Ename Age City Salary Deptid DeptName


E001 ABC 29 Pune 20000 D001 Finance
E002 PQR 30 Pune 30000 D002 Production
E003 LMN 25 Mumbai 5000 D003 Sales
E004 XYZ 24 Mumbai 4000 D004 Marketing
E005 STU 32 Bangalore 25000 D005 Human Resource
Hence, the decomposition is Lossless Join Decomposition.

 If the <Employee> table contains (Eid, Ename, Age, City, Salary) and <Department>
table contains (Deptid and DeptName), then it is not possible to join the two tables or
relations, because there is no common column between them. And it becomes Lossy Join
Decomposition.

2. Dependency Preservation

II YEAR/IV SEM Page 25


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

 Dependency is an important constraint on the database.


 Every dependency must be satisfied by at least one decomposed table.
 If {A → B} holds, then two sets are functional dependent. And, it becomes more useful
for checking the dependency easily if both sets in a same relation.
 This decomposition property can only be done by maintaining the functional dependency.
 In this property, it allows to check the updates without computing the natural join of the
database structure.

3. Lack of Data Redundancy

 Lack of Data Redundancy is also known as a Repetition of Information.


 The proper decomposition should not suffer from any data redundancy.
 The careless decomposition may cause a problem with the data.
 The lack of data redundancy property may be achieved by Normalization process.

NORMALIZATION

Normalization is a database design technique which organizes tables in a manner that reduces
redundancy and dependency of data.

It divides larger tables to smaller tables and links them using relationships.

Normalization is a systematic approach of decomposing tables to eliminate data


redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion
Anamolies. It is a multi-step process that puts data into tabular form, removing duplicated data
from the relation tables.

Normalization is used for mainly two purposes,

 Eliminating reduntant(useless) data.


 Ensuring data dependencies make sense i.e data is logically stored.

Problems without Normalization

II YEAR/IV SEM Page 26


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

If a table is not properly normalized and have data redundancy then it will not only eat up extra
memory space but will also make it difficult to handle and update the database, without facing
data loss. Insertion, Updation and Deletion Anamolies are very frequent if database is not
normalized. To understand these anomalies let us take an example of a Student table.

rollno name branch hod office_tel

401 Akon CSE Mr. X 53337

402 Bkon CSE Mr. X 53337

403 Ckon CSE Mr. X 53337

404 Dkon CSE Mr. X 53337

In the table above, we have data of 4 Computer Sci. students. As we can see, data for the fields
branch, hod(Head of Department) and office_tel is repeated for the students who are in the same
branch in the college, this is Data Redundancy.

Insertion Anomaly

Suppose for a new admission, until and unless a student opts for a branch, data of the student
cannot be inserted, or else we will have to set the branch information as NULL.

Also, if we have to insert data of 100 students of same branch, then the branch information will
be repeated for all those 100 students.

These scenarios are nothing but Insertion anomalies.

II YEAR/IV SEM Page 27


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Updation Anomaly

What if Mr. X leaves the college? or is no longer the HOD of computer science department? In
that case all the student records will have to be updated, and if by mistake we miss any record, it
will lead to data inconsistency. This is Updation anomaly.

Deletion Anomaly

In our Student table, two different informations are kept together, Student information and
Branch information. Hence, at the end of the academic year, if student records are deleted, we
will also lose the branch information. This is Deletion anomaly.

Normalization Rule

Normalization rules are divided into the following normal forms:

1. First Normal Form


2. Second Normal Form
3. Third Normal Form
4. BCNF
5. Fourth Normal Form

1. First Normal Form

If a relation contain composite or multi-valued attribute, it violates first normal form or a relation
is in first normal form if it does not contain any composite or multi-valued attribute. A relation is
in first normal form if every attribute in that relation is singled valued attribute.

For a table to be in the First Normal Form, it should follow the following 4 rules:

1. It should only have single(atomic) valued attributes/columns.


2. Values stored in a column should be of the same domain
3. All the columns in a table should have unique names.
4. And the order in which data is stored, does not matter.

II YEAR/IV SEM Page 28


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

1 – Relation STUDENT in table 1 is not in 1NF because of multi-valued attribute


STUD_PHONE. Its decomposition into 1NF has been shown in table 2.

Example 2 –

ID Name Courses
------------------
1 A c1, c2
2 E c3
3 M C2, c3

In the above table Course is a multi valued attribute so it is not in 1NF.

Below Table is in 1NF as there is no multi valued attribute

ID Name Course
------------------
1 A c1
1 A c2
2 E c3
3 M c1
3 M c2

II YEAR/IV SEM Page 29


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

2. Second Normal Form

To be in second normal form, a relation must be in first normal form and relation must not
contain any partial dependency. A relation is in 2NF iff it has No Partial Dependency, i.e., no
non-prime attribute (attributes which are not part of any candidate key) is dependent on any
proper subset of any candidate key of the table.

For a table to be in the Second Normal Form,

1. It should be in the First Normal form.


2. And, it should not have Partial Dependency.

Partial Dependency – If proper subset of candidate key determines non-prime attribute, it is


called partial dependency.

 Example 1 – In relation STUDENT_COURSE given in Table 3,


 FD set: {COURSE_NO->COURSE_NAME}
 Candidate Key: {STUD_NO, COURSE_NO}

In FD COURSE_NO->COURSE_NAME, COURSE_NO (proper subset of candidate


key) is determining COURSE_NAME (non-prime attribute). Hence, it is partial
dependency and relation is not in second normal form.
To convert it to second normal form, we will decompose the relation
STUDENT_COURSE (STUD_NO, COURSE_NO, COURSE_NAME) as :

STUDENT_COURSE (STUD_NO, COURSE_NO)


COURSE (COURSE_NO, COURSE_NAME)

II YEAR/IV SEM Page 30


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Note – This decomposition will be lossless join decomposition as well as depen dency
preserving.

Example 2 – Consider following functional dependencies in relation R (A, B , C, D )

AB -> C [A and B together determine C]


BC -> D [B and C together determine D]
Example 2:

In the above relation, AB is the only candidate key and there is no partial dependency, i.e., any
proper subset of AB doesn‘t determine any non-prime attribute.

 Prime attribute − An attribute, which is a part of the candidate-key, is known as a prime


attribute.
 Non-prime attribute − An attribute, which is not a part of the prime-key, is said to be a
non-prime attribute.

If we follow second normal form, then every non-prime attribute should be fully functionally
dependent on prime key attribute. That is, if X → A holds, then there should not be any proper
subset Y of X, for which Y → A also holds true.

We see here in Student_Project relation that the prime key attributes are Stu_ID and Proj_ID.
According to the rule, non-key attributes, i.e. Stu_Name and Proj_Name must be dependent upon
both and not on any of the prime key attribute individually. But we find that Stu_Name can be
identified by Stu_ID and Proj_Name can be identified by Proj_ID independently. This is called
partial dependency, which is not allowed in Second Normal Form.

II YEAR/IV SEM Page 31


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

broke the relation in two as depicted in the above picture. So there exists no partial dependency.

3. Third Normal Form –

A relation is in third normal form, if there is no transitive dependency for non-prime attributes
is it is in second normal form.
A relation is in 3NF iff at least one of the following condition holds in every non-trivial
function dependency X –> Y

1. X is a super key.
2. Y is a prime attribute (each element of Y is part of some candidate key).

A table is said to be in the Third Normal Form when,

 It is in the Second Normal form.


 And, it doesn't have Transitive Dependency.

Transitive dependency – If A->B and B->C are two FDs then A->C is called transitive
dependency.

 Example 1 – In relation STUDENT given in Table 4,

II YEAR/IV SEM Page 32


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

FD set: {STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE -


> STUD_COUNTRY, STUD_NO -> STUD_AGE, STUD_STATE ->
STUD_COUNTRY}
Candidate Key: {STUD_NO}

For this relation in table 4, STUD_NO -> STUD_STATE and STUD_STATE ->
STUD_COUNTRY are true. So STUD_COUNTRY is transitively dependent on
STUD_NO. It violates third normal form. To convert it in third normal form, we will
decompose the relation STUDENT (STUD_NO, STUD_NAME, STUD_PHONE,
STUD_STATE, STUD_COUNTRY_STUD_AGE) as:
STUDENT (STUD_NO, STUD_NAME, STUD_PHONE, STUD_STATE, STUD_AGE)
STATE_COUNTRY (STATE, COUNTRY)

 Example 2 – Consider relation R(A, B, C, D, E)


A -> BC,
CD -> E,
B -> D,
E -> A
All possible candidate keys in above relation are {A, E, CD, BC} All attribute are on
right sides of all functional dependencies are prime.

Another Example:

Example: Suppose a company wants to store the complete address of each employee, they create
a table named employee_details that looks like this:

emp_id emp_name emp_zip emp_state emp_city emp_district

1001 John 282005 UP Agra Dayal Bagh

1002 Ajeet 222008 TN Chennai M-City

1006 Lora 282007 TN Chennai Urrapakkam

1101 Lilly 292008 UK Pauri Bhagwan

II YEAR/IV SEM Page 33


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

1201 Steve 222999 MP Gwalior Ratan

Super keys: {emp_id}, {emp_id, emp_name}, {emp_id, emp_name, emp_zip}…so on


Candidate Keys: {emp_id}
Non-prime attributes: all attributes except emp_id are non-prime as they are not part of any
candidate keys.

Here, emp_state, emp_city & emp_district dependent on emp_zip. And, emp_zip is dependent on
emp_id that makes non-prime attributes (emp_state, emp_city & emp_district) transitively
dependent on super key (emp_id). This violates the rule of 3NF.

To make this table complies with 3NF we have to break the table into two tables to remove the
transitive dependency:

employee table:

emp_id emp_name emp_zip

1001 John 282005

1002 Ajeet 222008

1006 Lora 282007

1101 Lilly 292008

1201 Steve 222999

employee_zip table:

emp_zip emp_state emp_city emp_district

282005 UP Agra Dayal Bagh

222008 TN Chennai M-City

282007 TN Chennai Urrapakkam

II YEAR/IV SEM Page 34


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

292008 UK Pauri Bhagwan

222999 MP Gwalior Ratan

DEPENDENCY PRESERVATION

The dependency preservation decomposition is another property of decomposed relational


database schema D in which each functional dependency X -> Y specified in F either appeared
directly in one of the relation schemas Ri in the decomposed D or could be inferred from the
dependencies that appear in some Ri.

Decomposition D = { R1 , R2, R3,,.., ,Rm} of R is said to be dependency-preserving with respect


to F if the union of the projections of F on each Ri , in D is equivalent to F. In other words, R
⊂ join of R1, R1 over X. The dependencies are preserved because each dependency in F
represents a constraint on the database. If decomposition is not dependency-preserving, some
dependency is lost in the decomposition.

Example:
Let a relation R(A,B,C,D) and set a FDs F = { A -> B , A -> C , C -> D} are given.
A relation R is decomposed into -

R1 = (A, B, C) with FDs F1 = {A -> B, A -> C}, and


R2 = (C, D) with FDs F2 = {C -> D}.
F' = F1 ∪ F2 = {A -> B, A -> C, C -> D}
so, F' = F.
And so, F'+ = F+.

Thus, the decomposition is dependency preserving decomposition.

II YEAR/IV SEM Page 35


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Boyce and Codd Normal Form (BCNF)

Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals
with certain type of anomaly that is not handled by 3NF. A 3NF table which does not have
multiple overlapping candidate keys is said to be in BCNF. For a table to be in BCNF, following
conditions must be satisfied:

 R must be in 3rd Normal Form


 and, for each functional dependency ( X → Y ), X should be a super Key.

Example 1 – Find the highest normal form of a relation R(A,B,C,D,E) with FD set as {BC->D,
AC->BE, B->E}
Step 1. As we can see, (AC)+ ={A,C,B,E,D} but none of its subset can determine all attribute of
relation, So AC will be candidate key. A or C can‘t be derived from any other attribute of the
relation, so there will be only 1 candidate key {AC}.
Step 2. Prime attribute are those attribute which are part of candidate key {A,C} in this example
and others will be non-prime {B,D,E} in this example.
Step 3. The relation R is in 1st normal form as a relational DBMS does not allow multi-valued or
composite attribute.
The relation is in 2nd normal form because BC->D is in 2nd normal form (BC is not
subset of candidate key AC) and AC->BE is in 2nd normal form (AC is candidate key) and B->E
is in 2nd normal form (B is not a proper subset of candidate key AC).
The relation is not in 3rd normal form because in BC->D (neither BC is a super key nor D is a
prime attribute) and in B->E (neither B is a super key nor E is a prime attribute) but to satisfy 3rd
normal for, either LHS of an FD should be super key or RHS should be prime attribute.
So the highest normal form of relation will be 2nd Normal form.

 Example 2 –For example consider relation R(A, B, C)


A -> BC,
B ->
A and B both are super keys so above relation is in BCNF.

II YEAR/IV SEM Page 36


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Key Points –

 BCNF is free from redundancy.


 If a relation is in BCNF, then 3NF is also also satisfied.
 If all attributes of relation are prime attribute, then the relation is always in 3NF.
 A relation in a Relational Database is always and at least in 1NF form.
 Every Binary Relation ( a Relation with only 2 attributes ) is always in BCNF.
 If a Relation has only singleton candidate keys( i.e. every candidate key consists of only
1 attribute), then the Relation is always in 2NF( because no Partial functional dependency
possible).
 Sometimes going for BCNF form may not preserve functional dependency. In that case
go for BCNF only if the lost FD(s) is not required, else normalize till 3NF only.
 There are many more Normal forms that exist after BCNF, like 4NF and more. But in
real world database systems it‘s generally not required to go beyond BCNF.

Exercise 1: Find the highest normal form in R (A, B, C, D, E) under following functional
dependencies.
ABC --> D
CD --> AE
Important Points for solving above type of question.
1) It is always a good idea to start checking from BCNF, then 3 NF and so on.
2) If any functional dependency satisfied a normal form then there is no need to check for
lower normal form. For example, ABC –> D is in BCNF (Note that ABC is a super key),
so no need to check this dependency for lower normal forms.

Candidate keys in given relation are {ABC, BCD}


BCNF: ABC -> D is in BCNF. Let us check CD -> AE, CD is not a super key so this
dependency is not in BCNF. So, R is not in BCNF.

3NF: ABC -> D we don‘t need to check for this dependency as it already satisfied
BCNF. Let us consider CD -> AE. Since E is not a prime attribute, so relation is not in
3NF.

II YEAR/IV SEM Page 37


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

2NF: In 2NF, we need to check for partial dependency. CD which is a proper subset of a
candidate key and it determine E, which is non prime attribute. So, given relation is also
not in 2 NF. So, the highest normal form is 1 NF.
Exercise 2:

Example: Suppose there is a company wherein employees work in more than one department.
They store the data like this:

emp_id emp_nationality emp_dept dept_type dept_no_of_emp

1001 Austrian Production and planning D001 200

1001 Austrian stores D001 250

1002 American design and technical support D134 100

1002 American Purchasing department D134 600

Functional dependencies in the table above:


emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}

Candidate key: {emp_id, emp_dept}

The table is not in BCNF as neither emp_id nor emp_dept alone are keys.

To make the table comply with BCNF we can break the table in three tables like this:
emp_nationality table:

emp_id emp_nationality

1001 Austrian

1002 American

II YEAR/IV SEM Page 38


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

emp_dept table:

emp_dept dept_type dept_no_of_emp

Production and planning D001 200

stores D001 250

design and technical support D134 100

Purchasing department D134 600

emp_dept_mapping table:

emp_id emp_dept

1001 Production and planning

1001 stores

1002 design and technical support

1002 Purchasing department

Functional dependencies:
emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}

Candidate keys:
For first table: emp_id
For second table: emp_dept
For third table: {emp_id, emp_dept}

This is now in BCNF as in both the functional dependencies left side part is a key.

MULTI-VALUED DEPENDENCY

A table is said to have multi-valued dependency, if the following conditions are true,

II YEAR/IV SEM Page 39


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

1. For a dependency A → B, if for a single value of A, multiple value of B exists, then the
table may have multi-valued dependency.
2. Also, a table should have at-least 3 columns for it to have a multi-valued dependency.
3. And, for a relation R(A,B,C), if there is a multi-valued dependency between, A and B,
then B and C should be independent of each other.

If all these conditions are true for any relation(table), it is said to have multi-valued dependency.

 Multivalued dependency occurs when two attributes in a table are independent of each
other but, both depend on a third attribute.
 A multivalued dependency consists of at least two attributes that are dependent on a third
attribute that's why it always requires at least three attributes.

Example: Suppose there is a bike manufacturer company which produces two colors(white and
black) of each model every year.

BIKE_MODEL MANUF_YEAR COLOR

M2011 2008 White

M2001 2008 Black

M3001 2013 White

M3001 2013 Black

M4006 2017 White

M4006 2017 Black

Here columns COLOR and MANUF_YEAR are dependent on BIKE_MODEL and independent
of each other.

In this case, these two columns can be called as multivalued dependent on BIKE_MODEL. The
representation of these dependencies is shown below:

1. BIKE_MODEL → → MANUF_YEAR
2. BIKE_MODEL → → COLOR

II YEAR/IV SEM Page 40


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

This can be read as "BIKE_MODEL multidetermined MANUF_YEAR" and "BIKE_MODEL


multidetermined COLOR".

Fourth normal form (4NF):

Fourth normal form (4NF) is a level of database normalization where there are no non-trivial
multivalued dependencies other than a candidate key. It builds on the first three normal forms
(1NF, 2NF and 3NF) and the Boyce-Codd Normal Form (BCNF). It states that, in addition to a
database meeting the requirements of BCNF, it must not contain more than one multivalued
dependency.

Properties – A relation R is in 4NF if and only if the following conditions are satisfied:

1. It should be in the Boyce-Codd Normal Form (BCNF).


2. the table should not have any Multi-valued Dependency.

A table with a multivalued dependency violates the normalization standard of Fourth Normal
Form (4NK) because it creates unnecessary redundancies and can contribute to inconsistent data.
To bring this up to 4NF, it is necessary to break this information into two tables.

Example – Consider the database table of a class whaich has two relations R1 contains student
ID(SID) and student name (SNAME) and R2 contains course id(CID) and course name
(CNAME).
Table – R1(SID, SNAME)

SID SNAME

S1 A
S2 B
Table – R2(CID, CNAME)

CID CNAME

C1 C

II YEAR/IV SEM Page 41


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

CID CNAME

C2 D

When there cross product is done it resulted in multivalued dependencies:


Table – R1 X R2

SID SNAME CID CNAME

S1 A C1 C
S1 A C2 D
S2 B C1 C
S2 B C2 D

Multivalued dependencies (MVD) are:

SID->->CID; SID->->CNAME; SNAME->->CNAME

Joint dependency – Join decomposition is a further generalization of Multivalued dependencies.


If the join of R1 and R2 over C is equal to relation R then we can say that a join
dependency (JD) exists, where R1 and R2 are the decomposition R1(A, B, C) and R2(C, D) of a
given relations R (A, B, C, D). Alternatively, R1 and R2 are a lossless decomposition of R. A JD
⋈ {R1, R2, …, Rn} is said to hold over a relation R if R1, R2, ….., Rn is a lossless-join
decomposition. The *(A, B, C, D), (C, D) will be a JD of R if the join of join‘s attribute is equal
to the relation R. Here, *(R1, R2, R3) is used to indicate that relation R1, R2, R3 and so on are a
JD of R.

Let R is a relation schema R1, R2, R3……..Rn be the decomposition of R. r( R ) is said to satisfy
join dependency if and only if

II YEAR/IV SEM Page 42


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Example –

Table – R1

Company Product

C1 pendrive
C1 mic
C2 speaker
C2 speaker
Company->->Product
Table – R2

Agent Company

Aman C1
Aman C2
Mohan C1
Agent->->Company
Table – R3

Agent Product

Aman pendrive
Aman mic
Aman speaker
Mohan speaker
Agent->->Product

Table – R1⋈R2⋈R3

Company Product Agent

C1 pendrive Aman

II YEAR/IV SEM Page 43


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Company Product Agent

C1 mic Aman
C2 speaker speaker
C1 speaker Aman
Agent->->Product

JOIN DEPENDENCY
The anomalies of multivalued dependency and are eliminated by join dependency (JD) and 5NF.

A join dependency (JD) can be said to exist if the join of R1 and R2 over C is equal to relation R.
Where, R1 and R2 are the decompositions R1(A, B, C), and R2 (C,D) of a given relations R (A, B,
C, D). Alternatively, R1 and R2 is a lossless decomposition of R. In other words, *(A, B, C, D),
(C, D) will be a join dependency of R if the join of the join‘s attributes is equal to relation R.
Here, *(R1, R2, R3, ....) indicates that relations R1, R2, R3 and so on are a join dependency (JD) of
R. Therefore, a necessary condition for a relation R to satisfy a JD *(R1, R2,...., Rn) is that R.

Fifth Normal Form / Projected Normal Form (5NF):

A relation R is in 5NF if and only if every join dependency in R is implied by the candidate keys
of R. A relation decomposed into two relations must have loss-less join Property, which ensures
that no spurious or extra tuples are generated, when relations are reunited through a natural join.

Properties – A relation R is in 5NF if and only if it satisfies following conditions:

1. R should be already in 4NF.


2. It cannot be further non loss decomposed (join dependency)

Example – Consider the above schema, with a case as ―if a company makes a product and an
agent is an agent for that company, then he always sells that product for the company‖. Under
these circumstances, the ACP table is shown as:

Table – ACP

II YEAR/IV SEM Page 44


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Agent Company Product

A1 PQR Nut
A1 PQR Bolt
A1 XYZ Nut
A1 XYZ Bolt
A2 PQR Nut

The relation ACP is again decompose into 3 relations. Now, the natural Join of all the three
relations will be shown as:

Table – R1

Agent Company

A1 PQR
A1 XYZ
A2 PQR
Table – R2

Agent Product

A1 Nut
A1 Bolt
A2 Nut
Table – R3

Company Product

PQR Nut

PQR Bolt

II YEAR/IV SEM Page 45


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Company Product

XYZ Nut

XYZ Bolt

Result of Natural Join of R1 and R3 over ‗Company‘ and then Natural Join of R13 and R2 over
‗Agent‘and ‗Product‘ will be table ACP.

Hence, in this example, all the redundancies are eliminated, and the decomposition of ACP is a
lossless join decomposition. Therefore, the relation is in 5NF as it does not violate the property
of lossless join.

Normalization Exercise
INVOICE
HILLTOP ANIMAL HOSPITAL DATE: JAN 13/2002
INVOICE # 987

MR. RICHARD COOK


123 THIS STREET
MY CITY, ONTARIO
Z5Z 6G6

PET PROCEDURE AMOUNT

ROVER RABIES VACCINATION 30.00


MORRIS RABIES VACCINATION 24.00

II YEAR/IV SEM Page 46


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

TOTAL 54.00
TAX (8%) 4.32

AMOUNT OWING 58.32


UNF:
invoice [ invoice_no, invoice_date, cust_name, cust_addr, ( pet_name,
procedure, amount ) ]
1NF:
invoice [ invoice_no, invoice_date, cust_name, cust_addr ]
invoice_pet [ invoice_no, pet_id, pet_name, procedure, amount ]

note: pet_id was chose as a key because pet_name is a character string and not a good key
candidate.
2NF:
invoice [ invoice_no, invoice_date, cust_name, cust_addr ]
invoice_pet [ invoice_no, pet_id, procedure, amount ]
pet [ pet_id, pet_name ]
3NF:
invoice [ invoice_no, invoice_date, cust_no (FK) ]
invoice_pet [ invoice_no (FK), pet_id (FK), procedure, amount ]
pet [ pet_id, pet_name ]
customer [ cust_no, cust_name, cust_street, cust_city, cust_pstlcd ]
note: cust_no was chose as a key because cust_name is a character string and not a good
key candidate. The customer address was broken apart in 3NF. All foreign keys are
identified.

-------------------------------------------

II YEAR/IV SEM Page 47


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

TWO MARKS

1. What is an entity relationship model?


The entity relationship model is a collection of basic objects called entities and relationship
among
those objects. An entity is a thing or object in the real world that is distinguishable from other
objects.
2. What are attributes? Give examples.
An entity is represented by a set of attributes. Attributes are descriptive properties possessed by
each member of an entity set.
Example: possible attributes of customer entity are customer name, customer id, Customer
Street, customer city.
3. What is relationship? Give examples
A relationship is an association among several entities.
Example: A depositor relationship associates a customer with each account that he/she has.
4. Define the terms i) Entity set ii) Relationship set
Entity set: The set of all entities of the same type is termed as an entity set.
Relationship set : The set of all relationships of the same type is termed as a relationship set.
5. Define single valued and multi valued attributes.
Single valued attributes: attributes with a single value for a particular entity are called single
valued attributes.
Multi valued attributes: Attributes with a set of value for a particular entity are called
multivalued attributes.
6. What are stored and derived attributes?
Stored attributes: The attributes stored in a data base are called stored attributes.
Derived attributes: The attributes that are derived from the stored attributes are called derived
attributes.
7. What are composite attributes?
Composite attributes can be divided in to sub parts.
Stored attributes: The attributes stored in a data base are called stored attributes.
Derived attributes: The attributes that are derived from the stored attributes are called derived
attributes.
8. Define null values.
In some cases a particular entity may not have an applicable value for an attribute or if we do not
know the value of an attribute for a particular entity. In these cases null value is used.
9. Define the terms i) Entity type ii) Entity set
Entity type: An entity type defines a collection of entities that have the same attributes.
Entity set: The set of all entities of the same type is termed as an entity set.
10. What is meant by the degree of relationship set?
The degree of relationship type is the number of participating entity types.

II YEAR/IV SEM Page 48


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

11. Define the terms.


i) Key attribute
ii) Value set
Key attribute : An entity type usually has an attribute whose values are distinct from each
individual entity in the collection. Such an attribute is called a key attribute.
Value set: Each simple attribute of an entity type is associated with a value set that specifies the
set of values that may be assigned to that attribute for each individual entity.
12.What does the cardinality ratio specify?
Mapping cardinalities or cardinality ratios express the number of entities to which another entity
can be associated. Mapping cardinalities must be one of the following:
• One to one
• One to many
• Many to one
• Many to many
13. Define weak and strong entity sets.
Weak entity set: entity set that do not have key attribute of their own are called weak entity sets.
Strong entity set: Entity set that has a primary key is termed a strong entity set.
14. What are the two types of participation constraint?
Total: The participation of an entity set E in a relationship set R is said to be total if every entity
in E participates in at least one relationship in R.
Partial: if only some entities in E participate in relationships in R, the participation of entity set
E in relationship R is said to be partial.
15.What is meant by lossless-join decomposition? APRIL/MAY-2011
We claim the above decomposition is lossless. How can we decide whether decomposition is
lossless?
1. Let R be a relation schema.
2. Let F be a set of functional dependencies on R.
3. Let and form a decomposition of R.
4. The decomposition is a lossless-join decomposition of R if at least one of the following functional
dependencies are in :
a. R1∩R2→R1
b. R1∩R2→R2

16.What is first normal form?


The domain of attribute must include only atomic (simple, indivisible) values.
17. What is meant by functional dependencies?
Consider a relation schema R and a C R and ß C R. The functional dependency a ß holds on
relational schema R if in any legal relation r(R), for all pairs of tuples t1 and t2 in r such that
t1 [a] =t1 [a], and also t1 [ß] =t2 [ß].
18. What are the uses of functional dependencies?

II YEAR/IV SEM Page 49


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

To test relations to see whether they are legal under a given set of functional dependencies. To
specify constraints on the set of legal relations.
19. What meant by trivial dependency?
Functional dependency of the form a ß is trivial if ß C a. Trivial functional dependencies are satisfied
by all the relations.
20. What are axioms?
Axioms or rules of inference provide a simpler technique for reasoning about functional
dependencies.
21. What is meant by computing the closure of a set of functional dependency?
+ The closure of F denoted b y F is the set of functional dependencies logically implied by F.
22. What is meant by normalization of data?
It is a process of analyzing the given relation schemas based on their Functional Dependencies (FDs)
and primary key to achieve the properties
Minimizing redundancy
Minimizing insertion, deletion and updating anomalies .
23.Define Boyce codd normal form .
A relation schema R is in BCNF with respect to a set F of functional + dependencies if, for all
functional dependencies in F of the form. a->ß, where a
24.List out the desirable properties of decomposition.
-join decomposition

25. What is 2NF?


A relation schema R is in 2NF if it is in 1NF and every non-prime attribute A in R
is fully functionally dependent on primary key.
26 Write the limitations of E-R model. (MAY/JUNE-07)
The limitations of E-R model are:
There is no industry standard notation for developing an E-R diagram
The E-R data model is especially popular for high level
27. Write the reasons why null values might be introduced into the database. (NOV/DEC-
07)
SQL allows NULLs as attribute values, a constraint NOT NULL may be specified
if NULL is not permitted for a particular attribute.
28. Why is it necessary to decompose a relation? (MAY/JUNE-07)
To avoid redundancy, we decompose a relation. There are two types of decomposition.
Loss less join decomposition
Lossy decomposition
29. What is meant by multivalued dependency? (APR/MAY-06,NOV/DEC-12)
A multivalued dependency X→→Y specified on relation schema R,where X and Y are
both subsets of R, specifies the following constraint on any relation state r of R: If two tuples

II YEAR/IV SEM Page 50


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

t1 and t2 exist in r such that t1[X] = t2[X], then two tuples t3 and t4 should also exist in r
with the following properties,
Where we use Z to denote (R – (X ∪ Y))
■ t3[X] = t4[X] = t1[X] = t2[X].
■ t3[Y] = t1[Y] and t4[Y] = t2[Y].
■ t3[Z] = t2[Z] and t4[Z] = t1[Z].
Whenever X→→Y holds, we say that X multi determines Y. Because of the symmetry
in the definition, whenever X →→ Y holds in R, so does X →→ Z. Hence, X →→ Y
implies X→→Z, and therefore it is sometimes written as X→→Y|Z.
30. Why are certain functional dependencies called trivial functional dependencies?
(MAY/JUNE-12)
A trivial functional dependency occurs when we describe a functional dependency
of an attribute on a collection of attributes that include the original attribute. This type of
functional dependency is called trivial because it can be derived from common sense. It is
obvious that if you already know the value of B, then the value of B can be uniquely
determined by that knowledge.
For example, ―{A, B} -> B‖ is a trivial functional dependency, as is ―{name, SSN} ->
SSN‖.
31. Write an example of a relation schema R and a set of dependencies such that R is in
BCNF, but not in 4NF. (MAY/JUNE-12)
Given the relation R=(A,B,C,D) and the set of functional dependencies
F‘=A->B, C->D, B->C allows three distinct BCNF decompositions.
R1= {(A,B),(C,D),(B,C)} is in BCNF as is
R2={(A,B),(C,D),(A,C)}
R3={(A,B),(C,D),(A,C)}
R4={(B,C),(A,D),(A,B)}
32. Write a note on functional dependencies. (APR/MAY-10)
A functional dependency, denoted by X → Y, between two sets of attributes X and Y that
are subsets of R specifies a constraint on the possible tuples that can form a relation state r of
R. The constraint is that, for any two tuples t1 and t2 in r that have t1[X] = t2[X], they must
also have t1[Y] = t2[Y].
This means that the values of the Y component of a tuple in r depend on, or are
determined by, the values of the X component; alternatively, the values of the X component
of a tuple uniquely (or functionally) determine the values of the Y component.
33. Define - Irreducible Set of Dependencies. (NOV/DEC -10)
A functional depending set S is irreducible if the set has the following three properties:
Each right set of a functional dependency of S contains only one attribute
Each left set of a functional dependency of S is irreducible. It means that
reducing any one attribute from left set will change the content of S (S will
lose some information)

II YEAR/IV SEM Page 51


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

Reducing any functional dependency will change the content of S


34. Define 3NF (NOV/DEC-13)
Third normal form (3NF) is based on the concept of transitive dependency. A functional
dependency X→Y in a relation schema R is a transitive dependency if there exists a set of
attributes Z in R that is neither a candidate key nor a subset of any key of R,10 and both
X→Z and Z→Y hold.

PART-B&C (MARK: 13/15)


1. A database is being constructed to keep track of teams and games of a sports league. A team
has a number of players,not all of whom a participate in each game and the result of the game
Design ER diagram and list its entities and attributes. (7).
2. What is aggregation in an ER model? Develop an ER diagram using aggregation in an ER
model? Develop an ER diagram using aggregation that captures the following
Information:
Employees work for projects. An employee working for a particular project uses various
machineries. Assume necessary attributes. State any assumptions you make .Also discuss about
the ER diagram you have designed (6).
3. Develop an ER diagram for
i) library management system
ii) life insurance company
4. Develop the following relation for published books:
BOOK (Book_title,Authorname,Booktvpe, Listprice,Author_affil, Publisher)
Author_affil refers to the affiliation of author. Suppose the following dependencies exist:
Book_title ~ Publisher, Book_type
Book_type ~ Listprice
Authorname ~ Author-affil
a. What normal form is the relation in? Explain your answer.
b. Apply normalization until you cannot decompose the relations further. State the reasons
behind each decomposition.
5. Construct an E-R diagram for a car-insurance company whose customers own one or more
cars each. Each car has associated with it zero to any number of recorded accidents. State any
assumptions you make.

6. Define a functional dependency. List and discuss the six inference rules for functional
dependencies. Give relevant examples.

7. Discuss Join Dependencies and Fifth Normal Form, and explain why 5NF?

8. Explain non-loss decomposition and functional dependencies with example?.

9. (a) Draw E-R diagram for the restaurant menu ordering system which will facilitate the food
items ordering and services within a restaurant. The entire restaurant scenario is detail as follow.

II YEAR/IV SEM Page 52


UNIT-2 CS8492-DATABASE MANAGEMENT SYSTEM

The customer is able to view to food items menu, call the waiter, place order and obtain the final
bill through the computer kept in their table. The waiter through their wireless tablet PC are able
to initialize a table for customer, control the table function to assist customer, orders, sent order
to food preparation staff (chef) and finalize the customer bill. The food preparation staff (chef),
with their touch display interfaces to the system,are able to view orders to sent the kitchen by
waiter. During preparation they are able to let the waiter know the status of each items are
completed. The system should have full accountability and logging facilities and should support
supervisors action to account for exceptional circumstances, such as a meal being refunded or
walked out on.(Apr/May-15)

10. State the need for normalization of a data base and explain the various normal forms (1st,
2nd, 3rd BCNF, 4th, 5thand domain key) with suitable example.(Apr/May-15)
11.Normalize the following relation
Employee(Emp_Name,Skills,Birth_date,Department,Name,Department-Manager)(Apr/May-16)

12.Noramlize the relation student(regno,name,brach_code,branch-


name,semester,Sub_mark1,sub_mark2,sub_mark3,total,result,cgpa,attendance)( Apr/May-16)

13.Consider the closureof the following set of functional dependencies AB->C,C->D,D->A for
the relation R=(A,B,C,D).Also list the candidate key for R.(Apr/May-16)

-----------------------------------------------------------------------------------

II YEAR/IV SEM Page 53

You might also like