Beruflich Dokumente
Kultur Dokumente
5 EXERCISES
8.1 Simplify the following query, expressed in SQL, on our example database
using idempotency rules:
SELECT END
FROM ASG
WHERE RESP = "Analyst"
AND NOT(PNO="P2" OR DUR=12)
AND PNO # "P2"
AND DUR=12
8.2 Give the query graph of the following query, expressed in SQL, on our
example database:
G
lgorithm. .
*8.4 ansform the operator tree of Figure 8.5 back to the tree of Figure 8.3
sing the restructuring algorithm. Describe each intermediate tree and show
which rule the transformation is based on.
.fj
\
'->
...
--,
,. 226 Query Decompositionand Data Localization. Chapter 8
SELECT ENAME,SAL .
FROM EMF,PRoJ,ASG,PAY
WHERE EMP.ENo = ASG.ENo
AND EMF.TITLE = PAY.TITLE
AND (BUDGET>200000 OR DUR>24)
AND ASG.PNo = PRoJ.PNo
8.6 Assume that relation PROJ of the sample database is horizontally frag-
mented in
SELECT BUDGET
FROM PRoJ,ASG
WHERE PRoJ.PNo = ASG.PNO
AND ASG.PNo = 'cp4"
Transform the following query into a reduced query on fragments, and de-
termine whether it is better than the generic query:
EMP1 IIENo,ENAME(EMP)
EMP2 IIENo,TITLE (EMP)
SELECT ENAME
FROM EMP,ASG.PROJ
WHERE PROJ.PNO = ASG.PNO
AND PNAME = «Instrumentation "
AND EMP.ENO= ASG.ENO