0% found this document useful (0 votes)
20 views20 pages

Adobe Scan 20 Jun 2022

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)
20 views20 pages

Adobe Scan 20 Jun 2022

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/ 20

IMPLEMENTATION OF JOINS

A JOIN clause is used to combine rows from two or more tables, based on a related column between
them.

Types ofSOL JOINS:


There are 4 different types of SQL joins.
(INNER) JOIN: Returns records that have matching values in both tables
LEFT(OUTER) JOIN: Return all records from the left table, and the matched records from the right table
RIGHT(QUTER) JOIN: Return all records from the right table, and the matched records from the left
table
FULLOUTER) JOIN: Return all records when there is a match in either left or right table

INNER JOIN LEFT JOIN

table1 table2 table table2

RIGHT JOIN FULL OUTER JOIN

table table2 table1 table2

1. INNER JOIN: The INNER JOIN keyword selects records that have matching values in both tables
Syntax:
select column_name(s) from tablel inner join table2
on tablel.column_name =
table2.column_name
2. LEFT JOIN: The LEFT JOIN keyword returns all records from the left table (tablel), and the matched
records from the right table (table2). The result is NULL from the right side, if there is no match.
Syntax:
select column_namefs}from table lleft join table2
on tablel.column_name = lable2.column_name;

3. RIGHT JOIN: The RIGHT JOIN keyword returns all records from the right table (table2), and the
matched records from the left table (table1). The result is NULL from the left side, when there is no match.
Syntax:
select column_name(s)from table lright join table2
on tablel.column_name table2.column_name;

4. FULL JOIN: The FULL OUTER JOIN keyword return all records when there is a match in either left
(table 1) or right (table2) table records.

Syntax:
select column_namets)from table lfull outer join table2
on tablel.column_name = table2.column_name;

5. SQL SELF JOIN: A self JOIN is a regular join, but the table is joined with itself.
Syntax:
select column_name(s) from tablel tl, tablel t2 where condition;

EXAMPLES:
Consider the following two tables.
Table 1-CUSTOMERS Table isas follows.

ID NAME AGE|ADDRESS SALARY


Ramesh 31 Ahmadabad |2000.00
2Khilan 25 Delhi I500.00
Kaushik 23 Kota 2000.00
5 Hardik 27 Mumbai 6500.00
6 Komal 22 MP 4500.00
7Muffy24Indore 10000.00
Table 2-0RDERS Table is asfollows.
OID DATE CUSTOMER ID AMOUNT
102 2009-10-08 00:00:00 |3 3000
100 2009-10-08 00:00:00 3 1500
101 2009-11-20 00:00:00 2 I560

103 2008-05-20 00:00:00 4 2060

InnerJoin
SQL> SELECT id, name, amount, date FROM customers
INNER JOIN orders
ON customers.id = orders.customer_id;

This would produce the following result

ID NAME AMOUNT DATE


3 Kaushik 3000 2009-10-08-00:00:00
3 Kaushik 1500 2009-10-08 00:00:00
2 Khilan 1560 2009-11-20 00:00:00
Chaitali 2060 2008-05-20 00:00:00

Left Join:
SQL> SELECT id, name, amount, date FROM customers
LEFT JOIN orders
ON customers.id = orders.customer_id;

This would produce the following result


ID NAME AMOUNT |DATE
Ramesh NULL NULL
2 Khilan 1560 2009-11-20 00:00:00
3 Kaushik | 3000 2009-10-08-00:00:00
3 Kaushik 1500 2009-10-08 00:00:00
4 Chaitali 2060 2008-05-20 00:00:00
5 |Hardik NULL NULL
6 KomalNULL |NULL
7 Muffy NULL NULL

Right Join
SQL> SELECT id, name, amount, date FROM customers
RIGHT JOIN orders
ON customers.id =
orders.customer _id;
This would produce the following result-
ID NAME AMOUNT |DATE
3 Kaushik | 3000 2009-10-08-00:00:00
3 Kaushik1500 2009-10-08 00:00:00
2 Khilan 1560 2009-11-20 00:00:00
4Chaitali 2060 2008-05-20 00:00:00
Full Join:
SQL> SELECT id, name, amount, date FROM customers
FULL JON orders
ON customers.id = orders.customer_id;

This would produce the following result

ID NAMEAMOUNT | DATE
RameshNULL NULL
Khilan 1560 2009-11-20 00:00:00
Kaushik 3000 2009-10-08-00:00:00
Kaushik 1500 2009-10-08 00:00:00
Chaitali2060 2008-05-20 00:00:00
5 Hardik NULL NULL
6 Komal NULL NULL
7 Muffy NULL NULL
Kaushik 3000 2009-10-08-00:00:00
3Kaushik 1500 2009-10-08 00:00:00
2 Khilan 1560 2009-11-20 00:00:00
4Chaitali 2060 | 2008-05-20 00:00:00
VIEWS:
Aview is nothing more than a SQLstatement that is stored in the database with an associated name. A
viewis actually a compositionof atable in the form of a predefinedSQL query. Aview can containall rows of
atable or select rowsfrom a table. A view canbe createdfrom one or many tables which dependson the
writtenSQL query to create aview.
Views, which areatypeof virtualtables allow users todo thefollowing -

.Structuredata in awaythat usersorclasses of users find naturalorintuitive.


Restrict access to the data in such away that a user can see and(sometimes) modify exactlywhat they
needand no more.
Summarize data from various tables which can be used to generate reports.
SET OPERATIONS
These operators are used to combine information of similar datatype from one or more than one table.
Datatype of the corresponding columns in all the select statement should be same.
Different types of set commands are
UNION
UNION ALL
INTERSECT
MINUS
Set operators are combine 2 or more queries into one result.
T h e result ofeach SELECT statement can be treated as a set and SQL set operators can be applied on
those sets to arrive at a final result.
SQL statements containing set operators are referred to as compound queries, and each SELECT
statements in a command query in referred to as a compound query.
S e t operations are often called vertical joins, as a result combines data from 2 or more SELECT based on
columns instead of rows.

Syntax:
<compound query
UNION |UNION ALL| MINUS | INTERSECT
compound query>

UNION: Combines the result of 2 select statements into one result set, and then estimates any duplicate rows
from that result set.

UNION ALL: Combines the result of2 SELECT statements into one result set including the duplicates.

INTERSECT: Returns only the rows that are returned by each of two SELECT statements.

MINUS: Takes the result set of each SELECT statement, and removes those rows that are also recommended
by a second SELECT statement.
Q. What is Normal Form? What are steps in Normal Form2
NORMALIZATION: Normalization is the process of decomposing relations to produce
Smaller, well-structured relation.
To produce smaller and well structured relations, the needs to
user follow six
normal forms.
Steps in Normalization
normal form is state of relation that result from applying simple rules from
regarding functional dependencies ( relationships between attributes to that relation. The
normal form are
1 First normal form 2. Second normal form
3. Third normal form 4. Boyce/codd normal form
5. Fourth normal form 6. Fifth normal form

1) First Normal Form: Any multi-valued attributes (also called repeating groups) have
been removed,
2) Second Normal Form: Any partial functional dependencies have beenremoved.
3) Third Normal Form: Any transitive dependencies have been removed.
4) Boyce/Codd Normal Form: Any remaining anomalies that result from functional
dependencies have been removed.
5) Fourth Normal Form: Any multi-valued dependencies have beenremoved.
6) Fifth Normal Form: Any remaining anomalies have beenremoved.

Advantages of Normalized Relations Over the Un-normalized


Relations: The advantages of normalized relations over un-normalized relations are,
relation (table) does not
11 Normalized containrepeating groups whereas,
u-normalized relation (table) contains one or more
repeating groups
Normalized relation consists of a
primary key. There is no primary key presents
inun-normalized relation.
3) Normalization removes the repeating group which occurs many times in a table.
4) With the help of normalization process, we can transform un-normalized table
to First Normal Form (INF) by removing repeating groups from un-normalized
tables
5) Normalized relations (tables) gives the more simplified result whereas
un-normalized relation gives more complicated results.
6) Normalized relations improve storage efficiency, data integrity and scalability.
Butun-normalized relations cannot improvise the storage efficiency and data
imtegrity.
7) Normalization results in database consistency, flexible data accesses.

sCHEMA REFINEMENT (NORMALIZATION) : Purpose of Normalization or schema refinement, concept|


of
functional dependency, normal forms based on functional dependency(INF, 2NF and 3 NF), concept
of|
suTOCELe key. Boyce-codd normal form(BCNF), Lossless join and dependency preserving
Fourth normal form(4NF).
decomposition,

PURPOSEOF NORMALIZATIQN ORSCHEMA REFINEMENTI


Database Normalization is a technique of organizing the data in the database. Normalization is
a
systemat1c approach of decomposing tables to eliminate data redundancy and undesirable characteristics like
msertion Update and Deletion Anomalies. It is a multi-step
process that puts data into tabular form by
removing duplicated data from the relation tables. Ifa database design is not perfect, it may contain anomalies.
which are like a bad dream for any database administrator.
Managing a database with anomalies is next to|
mpossible
Normalization is used for mainly two purpose,
Elminating redundant (useless) data.
Ensuring data dependencies make sense i.e., data is logically stored.

Problem Without Normalization


Without Normalization, it becomes difficult to handle and
update the database, without facing data loss.
tsertion, Updation and Deletion Anamolies are very frequent if Database is not Normalized. To understand
thEs anomalies let us
take an example of Student table.

S_id S_name S_Address Subject_opted


401 Kesava Noida JAVA
402 Rama Panipat DBMS
403 Krishna Jammu DBMS
404 Kesava Noida Data Mining

pation Anamoly : 1f data items are scattered and are not linked to cach other properly, then it
Coulo to strange situations. For example, when we try to update one data item having its copies
instances get updated properly while a few others left wath old
Tedover several
places, a few are

ades. Such instances leave the database in an inconsistent stale.


FIRST NORMAL FORMUNE)
INE is to disallow multi valued attributes, composite attributes and their
designed
INE allows only atomic values i.c., the attributc of any tuple must be cither 1 or NULL value
combinaticw
A relation having multi valued and composite attributes is known
as Un Normalized
Relation
ofThese multi valucd and composite attributes will turn the UN Normalized Relation to INF Rclatic temeval
Example:
Professor
Un Normalized Relation Since
ID Name Salary salary is a Multi valued
attribute
Rama 40000,10000,1 5000,10000)
We eliminate this multi valued attribute by splitting the
can
Basic, TA, DA, HRA. The Above relation in INF is as follows.
salary column to more specific columns like

Professor
ID Name Basic TA
TA DA HRA INF
Rama 40000 10000 15000 10000

Every Relation in the Relation Database must be in INF.

ww
SECOND NORMAL EORM (2NE):
t denends on the concept of Full Functional
ndencies(PFD) i.e., for a relation that has Dependences(FFD)
and disallows Partial
concatenated Functional
f the primary key must depend upon the entire primary key, each attribute in the table that is
concatenated not
ly on one part of the concatenated key, then the relation fails key for its existence. If any attribute depends
on Second normal form.
A relation with Partial Functional
dependencies can be made as in 2NF by removing them.
PFD: part of key Non Key
FFD: Key Non key

Example:
Medication
Patient No. | Drug
Dependencies
No. of units Pname
P1 D 10 Kiran Patient No. Pname
P1 D2 20 Kiran
P1 D3 15 Patient
Kiran No.,Drug No. of units
P2 D4 15 Raj
The above relation is in 1NF but not in
2NF. for the relation is Patient No. and
eliminating the Partial functional dependencies, the Key Drug. After
decomposed relations are
Patient
Parent Relation Dependencies
Patient No. Pname
P1 Kiran Key: Patient No. Patient No. > Pname
P2
Raj

Medication Child Relation


Dependencies
Patient No. Drug No. of
units
P1 Di 10 Key: Patient No. and Drug Patient No.,Drug No. of
P1 D2 20 Patient No. is Foreign key units

Pl D3
referring Patient No. in the
15
Parent Relation (Patient)
P2 D4 15

The above 2 relations satisfy 2NF. They don't have partial functional dependencies.
Note: If key is only one attribute then the relation is always in 2NF.

awewweeoeneonaewreeraoo****A**** *****
wwww.eonaaM n
THIRD NORMAL FORM (3NE
Third Normal form applies that
every non-prime attribute of a relation must be
key, or we can say that, there should not be the case that a dependent on primary
prime attribute. non-prime attribute is determined by another
So this transitive functional
relation must be in Second Normal form. dependency should be removed from the relation and alsonon-
Simply, It is based on the concept of transitive the
disallows the transitive dependencies. dependencies. 3NF
Dependency: Key » Non Key
Transitive Dependency: Non Key Non
-
Key
A relation
satisfying 2NF and with Transitive Functional
dependencies can be made in 3NF
transitive functional dependencies. as
by removing the

Example:
Contains
Key
Patient No. Pname Ward No. Ward Name Patient No. and Pname
PI Kumar WI ICU Dependencies
P2 Kiran WI ICU Patient No., Pname Ward No.
P3 Kamal W1 ICU Ward No.» Ward Name (Transitive
P4 Sharath| W2 General Dependency)
Ward No. Ward Name is transitive because
transitive dependency must be removed Ward No. is not a key. To make this relation
from it. It can be done by satisfy 3NF
relations are as follows: decomposing the relation. The decomposed
Ward Key Dependencies
Ward No. | Ward Name
W1 ICU Ward No. Ward No. » Ward Name
W2 General

Contains
Primary Key Dependencies
Patient No. | Pname Ward No. Patient No. and Pname
PI Kumar W1
P2 Kiran W1
Patient No.,Pname Ward No.
Foreign Key
P3 Kamal WI Word No. refers Ward
P4
Sharath No. in relation Ward
W2

The above two relations satisfy 3NF.


They don't have transitive
Note 1: A relation R is said to be in 3NF dependencies.
holds then either X is a if whenevera non trivial functional
super key or A is a prime attribute. dependency of the form X A

Note 2: If all attributes are prime attributes


functional dependencies and transitive then the relation is in 3NFbecause with rtial
dependencies exists such attributes no paus
FOURTH NORMALFORM 4NE
Normalization to 4NF and 5NF are
When attributes in a relation have multi-valued dependency, further
in which cach and every attribute within
required. A multi-valued dependency is a typical kind of dependency
Consider a vendor supplying many
a relation depends upon the other. yet none of them is a unique primary key.
items to many projects in an organization. The following are the assumptions:

1. A vendor is capable of supplying many items.


2. A project uses many items.
3. A vendor supplies to many projects.
4 An item may be supplied by many vendors.

A multi valued dependency exists here because all the attributes depend upon the other and yet none of them is

primary key having unique value.


Vendor Code Item Code ProjectNo.
VI P1
Vi 12 P1

V1 | I1 P3
Vi 12 P3

v2 12 P1

V2 13 P1

V3 I1 P2

V3 I1 P3

The given relation has a number of problems. For example:


. Ifvendor VI has to supply to project P2, but the item is not yet decided, then a row with a blank for
item code has to be introduced.
2 The information about item 11 is stored twice for vendor V3.
Observe that the relation given is in 3NF and also in BCNF. It still has the problem mentioned above. The
problem is reduced by expressing this relation as two relations in the Fourth Normal Form (4NF). A
relation is in 4NF if it has no more than one independent multi valued dependency or one independent
multi valued dependency with a functional dependency.
The table be expressed as the two 4NF relations given as following. The fact that vendors are capable
can
ofsupplying certain items and that they are assigned to supply for some projects in independently specified|
in the 4NF relation.

Vendor_Supply Vendor_Project
Vendor Code Item Code Vendor Code Project No.

V1 I1 Vi P1

V1 12 V P3

V2 12 V2 P1

V2 13 V3 P2
V3
SUMA
BOYCE-CODD NORMAL FORMBCNF:
This form deals with certain type of anamoly that is not|
BCNF is a higher version of the Third Normal form.
candidate keys is said to be in
handled by 3NF. A 3NF relation which does not have multiple overlapping
BCNF. For a relation 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.
(OR)
A relationship is said to be in BCNF if it is already in 3NF and the left hand side of every dependency isa
candidate key. A relation which is in 3NF is almost always in BCNF. These could be same situation whena
3NF relation may not be in BCNF the following conditions are found true
1. The candidate keys are composite.
2. There are more than one candidate keys in the relation.
There are some common attributes in the relation.

Professor Code Department Head of Dept. Percent Time

PI Physics Ghosh 50

P1 Mathematics Krishnan 50
P2 Chemistry Rao 25

P2 Physics Ghosh 75

P3 Mathematics Krishnan 100

Consider. as an example, the above relation. It is assumed that:


1. A professor can work in more than one department
2 The percentage of the time he spends in each department is given.
3 Each department has only one Head of Department.

Dependencies oftheaboVe relation ar


Department,Professor Code Head of the Depatrment
Department,Professor Code Percent time
Department- Head of the Depatrment
Head of the Department,Professor Code Depatrment
Head of the Department,Professor Code Percent time

The given relation is in 3NF. Observe, however, that the names of Dept. and Head of
duplicated. Further, if Professor P2 resigns, rows 3 and 4 are deleted. We lose the Dept. are
Head of Department of Chemistry.
information that Rao is the
The normalization of the relation is done by
creating a relation for Dept. and Head of
Head of Dept. form the given relation. The normalized
new
Dept. and deleting
relations are shown in the following.

6
Professor_work Dependencies
Professor Code Department Percent Time
Department,Professor Code Percent
P1 Physics 50 time
P Mathcmatics 50 Department is
foreign key referring
P2 Chemistry 25 Department in the Deartment_Details
P2
relation
Physics 75
P3 Mathematics 100

Depatrment_Details Dependencies
Department Head of Dept. Department» Head of the Department
Physics Ghosh
Mathematics Krishnan
Chemistry Rao
schema Rennement (Nomalization)
4.23
FTH NORMAL FORM (5NF)
18
plain about Fith Normal Fom (5NF).
xpla

Answer Model PperV, No)


Normal
Form
(SNF)
ith
is said
relation to be in SNF if it is in
4NF and cannot be non-loss decomposed. Generally,
cved by decomposing an
individual table into two omoosition is achicved oy
different ables. But in SNF, Do
posing a taDie mio unree or more tables.
The join operator makes non-loss Coosider following
omp
example table. decumposilon p9>o* SiOCT the
Student
Emp_Address Ferformance
Ravi
Hyderabad
Kumar
Hyderabad Good
Ravi Delhi Avernge
Kumar Delhi Average
Ravi
Delhi Best
Iable: Student Teble

This table contns paur wse cyclic dependencies in the primary key. To detemmine
Emp_ad
the performance, must d one
and
student and
its Smary determine emp Address student,oDe identify student, performance
to and must
respectively.Ihis can de done by decomposing the table into three tables as follows,

Student Emp Address


Ravi Hyderabad
Kumar Hyderabad
Ravi Delhi

Kumar Delhi
Table: Stdent-Emp Addross
Student Performance
Ravi Good

Kumar Good

Ravi Average
Kumar Average

Ravi
Toble: StudestPorformance

Emp Address Performance


Hyderabad Good
Delhi Average

Delni Best
Teble: Emp_Address-rerformance

oblained are in SNF


three tables
Afer the decomposition, all the

STUDENTS
POR EvoiNEERING
sPECTROM AuANONE JOaRNAL
Q914. Explain about lossless join decomposiuon.
Answer t
Model Paper4, Q(o)

Lossless-joln Decomposition
or
is onc of the properlies
Lossless-join decomposition
dccompositions. This dependency is also called as non-addilnve
In more specific way, lossiess
Or non-los Join dependency.
a
no
can be defined as the one which generates
Join dependency
additional tuples when the natural "join" operation is pertomed

on the decomposed relation schemes.

Example
Consider the "STUDENT" relation.
STUDENT (Std id, Name, Location)
This relation can be broken-down into two relations as

follows,
(a). Location (Std_id, Location) and

(b) Name (Std_id, Name)


When a natural join operation is performed on these two0

schemes, the original "STUDENT" relation is sustained.


Location D Name STUDENT.
STUDENT

|Std_ld Location Name

012 Hyderabad Radha


013 Secunderabad Meena
014 Hyderabad Pinky
Rani
015 Secunderabad
Location Name

Std_i Location Stdid Name

O12 Hyderabad 012 Radha


013 Secunderabad 013 Meena
014 Hyderabad O1 Pinky

015 Secunderabad 015 Rani


Location DA Name > Student

Location Name
Std
012 Hyderabad Radha

013 Meena
Secunderabad
014 Hyderabad Pinky
015 Secunderabad Rani
No additional tuples are generated and neither data is
duplicated nor data is lost. Therefore the relation STUDENT
is lossless.
.18 DATABASE MANAGEE

Example
Given thal,
R(A, B, C. D, E. F)

he FDs ar

A BC
FA

CA

DE

EA
eromposed Relatlons
8, (4. C, D), R(B, C, D). R,(6, F, D)
In order to check **
whether the given relations are lossless or not, the following three conditions are to be satisied.

Condition
Every attnbute in R should be in at least one R, where 1 SiSn
Conditlon 2

Condition3

0)R,R,~R,
or R, nR, R
1e, the attnbutes common to both
R, and R, functionally detemine the attribute in either R, or R,
(n) Find the closure
of the intersection clement and verify if at least one of the functional dependencies are in the closure
Based on the three conditions, the
given example is solved as,
Condition1

R,.RR, consists of at least one attribute of relation k.


I condition is satisfied.

Conditlon 2

R,R (4CD) n (BCD)- CD


(R, UR)nR, = (4BCD)n (EFD)

Condition3
(CD)-CDAEBC
(D-DEADBC
) The functional dependencies in (CDy' C-A, DE and in (D)' areD-E,
are ~E
A- BC
Since, all the three conditions satisfied, the given decomposed relations
are
are lossless.
Requlrements of Lossless Decomposition
Let Rbe arelation schema. Aset of
relation
every attribute in Rshould present in at lcast on R0 schemas (R,. R KIS decomposition ofR ifR a

SiSn). Let r be a relation -


R, UR, UR,R,
onschemas R, R it
1s observea uhat r, ,
on schema R
and simil 1e
thegiven decomposition is lossless-join. awauys true.
Adecomposition is always ther
easy to find
WARNING: Xerow/Photocopying of this book is a CRIMINAL Bct. Anyone found
oulty Is LIABLE to fece
LEGAL proceedings.

NIT-4 Schema Refinement


be a
(Normalization) 4.19
Letr relation schema, and let F be set of functional a
Thissdecomposi
de iESS-JOin decomposition of R dependencies R, let R, and R, fornms decomposi on a R.
g inF (cloSure of F). with respects to F, if at least one of the
following functional dependencies
. R,RR,
2 R,RR,
R,nR=D (in this problem) and there is an FD, D>E.
R,R,E(E R)which satisfies the above condition (2n). Therefore, the decomposition is lossless.
CONCEPTOF FUNCTIONALDEPENDENCY
Functional dependency (FD) is a set of
constraints between two attributes in a
saysthat if two tuples have same values relation. Functional dependency
for attributes A1,
same values for attributes B1, B2, Bn. ..,
A2,. An, then those two
tuples must have to have
Functional dependency is
represented by an arrow
The left-hand side attributes determine the values sign (-~) that is. XY, where X functionally determines Y.
of attributes on the
right-hand side.
ARMSTRONG'SAXIOMS
If F is a set of functional
dependencies then the closure of F, denoted as F. is the sct of all
functional
dependencies logically implied by F. Armstrong's Axioms are a set of rules, that when
generates a closure of functional dependencies. applied repeatedly,
Reflexive rule I f alpha is a set of attributes and beta
is_subset_of alpha. then alpha holds beta.
Augmentation rule - If a b holds and y is attribute set. then
ay by also holds. That is adding »

attributes in dependencies, does not


change the basic dependencies.
Transitivity rule - Same as transitive rule in algebra, if a b holds and b ^ c holds, then a
holds. a b is called as a functionally that determines b. ealso

TRIVIALFUNCTIONAL DEPENDENCY
.Trivial-If a functional dependency (FD) X »
Y holds, where Y subset of X, then
is a it is called a
trivial FD. Trivial FDs always hold.
Non-trivial If an FD X- Y holds, where Y is not a subset ofX, then called
it is a non-trivial FD.
Completely non-trivial -

If an FD X Y holds, where x intersect Y =


0, it is said to be a completely
non-trivial FD.

PROPERTIES OFFUNCTIONAL DEPENDENCIES:


1 Reflexive: If YSX then X - Y is a Reflexive Functional Dependency.
Ex: AB-A, ASAB holds. Therefore AB-A is a Reflexive Functional Dependency.

is also tunctional
functional dependency then by augmentation. Xz-YZ
a
Augmentation:_If X-Y is a
dependency
3.Transitivity; IF X-Y and Y-Z are two functional dependencies then by transitivity, X-Z is also a
functional depcndency.

Union: If X-Y and XZ are two functional dependencies then, XYZ is alsoa functional dependency.

S. Decomposition: If x-YZ is a functional dependcncy then XY and X-Z are also functional
dependencies.
CLOSURE SET OF A FUNCTIONAL DEPENDENCY (F) It is
It is a set of all functional dependencies that can be determined using the given set of dependencies.
denoted by F.
of all the attributes that can be dctermined using X. It is denoted by X*,
Attribute Closure (X:It is a set

where X is any set of attributes.

Example:
R(A.B.C) F:{A-B, B-C}
A {A.B.C} B {B.C} C {C}
ABC={A.B.C}
AB {A,B.C} AC°={A.C,B} BC"={B,C}
associated with it
ldentifving keysin the given relation based on Functional Dependencies
set X of attributes.
X is a set of attributes that can be determined using given
the
relation.
IfX contains all the attributes of a relation, then X is called "Super key" of that
relation.
I f X is minimal set, then X is called "Candidate Key" of that
attributes of that
If noclosure contains all the elements then in such a case we can find independent
If the closure of the Independent
relation i.e., the attributes that which are not in the R.H.S. of any dependency.
attributes contains all the elements then it can be treated as a candidate key.
elements then we try to find the key
If the closure of independent attributes also doesn't contain all the
attributes one by one. If couldn't find key then we can add groups of dependent
by adding dependent we

attributes till we find a key to that relation.

You might also like