0% found this document useful (1 vote)
264 views9 pages

Query Processing Exercise

This document contains instructions and parts for an exercise on query processing using relational algebra on a sample company database. It provides the schema for the database relations and poses various query questions. It asks the student to provide relational algebra expressions for the queries and to choose algorithms for query evaluation plans. It also asks the student to estimate block transfers and seeks required for different join strategies on sample relations of different sizes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (1 vote)
264 views9 pages

Query Processing Exercise

This document contains instructions and parts for an exercise on query processing using relational algebra on a sample company database. It provides the schema for the database relations and poses various query questions. It asks the student to provide relational algebra expressions for the queries and to choose algorithms for query evaluation plans. It also asks the student to estimate block transfers and seeks required for different join strategies on sample relations of different sizes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 9

Query Processing

Exercise for 39-10

Database System
February, 16th 2017
Relational Algebra
employee (person_name, street, city )
Company works (person_name, company_name, salary)

Relational company (company_name, city)

Database manages (person_name, manager_name)

for Execise
Note: Use this schema for exercise part #1-3
Consider the Company Relational Database, where the
primary keys are underlined. Give an expression in the
relational algebra to express each of the following
queries:
a. Find the names of all employees who live in the
same city and on the same street as do their
Part #1 managers.
b. Find the names of all employees in this database
who do not work for Central Bank Corporation.
c. Find the names of all employees who earn more
than every employee of National Bank
Corporation.
Consider the Company Relational Database where the
primary keys are underlined. Give an expression in
relational algebra for each of the following queries:
a. Find all employees who work directly for Adam
b. Find all cities of residence of all employees who
Part #2 work directly for Adam
c. Find the name of the manager of the manager of
Adam
d. Find those employees who earn more than all
employees living in the city Sydney
a. Find the names of all employees who work for
Central Bank Corporation.
b. Find the names and cities of residence of all
employees who work for Central Bank
Corporation.
c. Find the names, street addresses, and cities of
residence of all employees who work for Central
Part #3 Bank Corporation and earn more than $15,000.
d. Find the names of all employees in this database
who live in the same city as the company for which
they work.
e. Assume the companies maybe located in several
cities. Find all companies located in every city in
which National Bank Corporation is located.
Query Evaluation
Plan
Choose 2 relational algebra (RA) expressions (from the
answer of previous exercises).
Part #4 For each RA, create a Query Evaluation Plan (QEP) by
selecting the appropriate algorithm.
Let relations r1(A, B,C) and r2(C, D, E) have the
following properties:
r1 has 100,000 tuples,r2 has 135,000 tuples, 25 tuples
of r1 t on one block, and 30 tuples of r2 t on one
block.
Part #5 Estimate the number of block transfers and seeks
required, using each of the following join strategies for
r1 r2:
a. Nested-loop join.
b. Block nested-loop join.

You might also like