2. FRAGMENTATION
Decomposing a database into multiple smaller units
called fragments , with the help of fragments it is
possible to reconstruct the original database .
3. A RELATION CAN BE FRAGMENTED INTO
THREE WAYS:
• Horizontal fragmentation
• Vertical fragmentation
• Mixed fragmentation
4. HORIZONTAL FRAGMENTATION:-
• A horizontal fragment of a relation is a subset of the
tuples in that relation.
For example:- Employee table
ecode ename esalary ecity
101 abc 30000 Jaipur
102 xyz 40000 Delhi
103 pqr 35000 Jaipur
104 lkm 36000 Pune
5. Create table fragment1 as
select * from employee
where ecity=‘jaipur’;
Create table fragment2 as
Select * from employee
Where ecity=‘delhi’;
Create table fragment3 as
Select * from employee
Where ecity=‘pune’;
ecode ename esalary ecity
101 abc 30000 Jaipur
103 pqr 35000 Jaipur
ecode ename esalary ecity
102 xyz 40000 Delhi
ecode ename esalary ecity
104 lkm 36000 Pune
6. RECONSTRUCTION
• With the help of union operation we can reconstruct the above relation.
Employee-
select * from fragment1
union
select * from fragment2
union
select * from fragment3;
7. VERTICAL FRAGMENTATION
In vertical fragmentation , the fragments are created by
dividing the attribute .
It is more complex then horizontal fragmentation.
For example:
Eid Ename Salary bonus project experience
1 Abc 40000 1000 P1 5
2 Ghi 50000 2000 P3 3
3 xyz 45000 1500 P2 2
8. create table fragment1 as
select eid, ename, salary from employee;
on the basis of basic details
eid Ename salary
1 Abc 40000
2 Ghi 50000
3 xyz 45000
create table fragment 2 as
select eid, bonus, project, experience
from employee;
on the basis of bonus on project
eid bonus project Experience
1 1000 P1 5
2 2000 P3 3
9. RECONSTRUCTION
• With the help of natural join we can reconstruct the
above relation.
select * from
fragment1
natural join
fragment2;