






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Example Schema 2: (a single relation)
ED( eno , ename, sal, dno, dname, floor, mgr)
Query 1: find all employees that make more than their manager
select e.ename from ED e, ED m where e.mgr=m.eno and e.sal>m.sal
Query 2: for each department, find the maximum salary
select d.dname, max(sal) from ED e group by dno
Q1 requires one join; Q2 requires just a group-by.
Shipment(S#, P#, J#) decomposed into SP(S#, P#) and SJ(P#, J#) s1 p1 j1 s1 p1 p1 j s2 p2 j1 s2 p2 p2 j s2 p3 j2 s2 p3 p3 j s3 p3 j3 s3 p3 p3 j s4 p4 j3 s4 p4 p4 j If we join SP and SJ again into SP-PJ(S#, P#, P#, J#) we get: s1 p1 p1 j s2 p2 p2 j s2 p3 p3 j2 from the joined tuples we cannot s2 p3 p3 j3 deduce the original form of the data. s3 p3 p3 j2 this is called the connection trap s3 p3 p3 j3 and the decomposition is lossy s4 p4 p4 j
R= (A, B) R 1 = (A) R 2 = (B)
? 1? 1 ? 2? 2 ? 1 R 1 X R 2 = (A, B) ? 1 ? 2 ? 1 ? 2
R = R 1? R 2 is lossless if at least one of the following dependencies holds R 1? R 2? R 1 R 1? R 2? R 2