The DataBase Course

Exercise No. 2

Relational Algebra

Due on November 25th by midnight

 

  1. In the given database, suppliers supply certain parts for certain projects. The information about who supplies what to which projects is found in the shipments table. The tables are:

Suppliers(s#,sname,status,city)
Parts(p#,pname,color,weight,city)
Projects(j#,jname,city)
Shipments(s#,p#,j#)

The s#,p#,j#,s# attributes are key attributes. Express the following queries in relational algebra:

The queries should be clearly explained!

 

  1. The formal definition of the Selection (delta) operator only allows us to use basic conditions for filtering relations: Only a1=a2 or a1>a2 conditions are allowed. Prove that using only these conditions, and the other relational algebra operators, we can represent these conditions:

a1 < a2
a1 <= a2
a1 >= a2
not (condition1)
(condition1) and (condition2)
(condition1) or (condition2)

where a1,a2 are attributes and condition1,condition2 are any (possibly complex) conditions.

 

 

  1. For each of the following operators - union, cartesian product, substraction, natural (eqvi) join, semi join and division - decide whether:

Explain your answers shortly. Formal proofs are not required.