Dbms Unit
Dbms Unit
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.
An entity set is a set of entities of the same type that share the same properties.
ER-Diagram is a visual representation of data that describes how data is related to each other.
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
Example: Customer & Loan entity set & its relationship borrower
Modeling
a collection of entities,
An entity set is a set of entities of the same type that share the same properties.
Notations:
Lines link attributes to entity sets and entity sets to relationship sets.
Roles
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.
Role labels are optional, and are used to clarify semantics of the relationship
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.
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:
Many-To-Many Relationship
one entity from A can be associated with more than one entity from B and vice versa.
Total participation (indicated by double line): every entity in the entity set participates
in at least one relationship in the relationship set
Partial participation: some entities may not participate in any relationship in the
relationship set
E-R DIAGRAM
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
structure diagrams introduced by Charles Bachman. One of the early forms of ER diagrams,
Bachman diagrams are named after him.
Ellipses: Attributes
Lines: They link attributes to Entity Sets and Entity sets to 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.
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.
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.
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.
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.
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.
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
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.
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
These concepts are used when the comes in EER schema and the resulting schema diagrams
called as EER Diagrams.
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
1. Generalization
Generalization is the process of generalizing the entities which contain the properties of
all the generalized entities.
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
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
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.
FUNCTIONAL DEPENDENCIES
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
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:
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.
1. Emp_Id → Emp_Name
Example:
Example:
1. ID → Name,
2. Name → DOB
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 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.
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:
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).
{Book} ->{Author} (if we know the book, we knows the author name)
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?
Properties of Decomposition
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,
. . . . 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.
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.
Employee ⋈ Department
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
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.
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.
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.
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
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:
Example 2 –
ID Name Courses
------------------
1 A c1, c2
2 E c3
3 M C2, c3
ID Name Course
------------------
1 A c1
1 A c2
2 E c3
3 M c1
3 M c2
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.
Note – This decomposition will be lossless join decomposition as well as depen dency
preserving.
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.
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.
broke the relation in two as depicted in the above picture. So there exists no partial dependency.
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).
Transitive dependency – If A->B and B->C are two FDs then A->C is called transitive
dependency.
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)
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:
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:
employee_zip table:
DEPENDENCY PRESERVATION
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 -
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:
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.
Key Points –
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.
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.
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:
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
emp_dept table:
emp_dept_mapping table:
emp_id emp_dept
1001 stores
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,
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.
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
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:
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
CID CNAME
C2 D
S1 A C1 C
S1 A C2 D
S2 B C1 C
S2 B C2 D
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
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
C1 pendrive Aman
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.
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.
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
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
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
TOTAL 54.00
TAX (8%) 4.32
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.
-------------------------------------------
TWO MARKS
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
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)
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?
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.
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)
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)
-----------------------------------------------------------------------------------