Tutorial_8_Questions
Tutorial_8_Questions
How many tuples will be returned by the following relational algebra query?
Write a relational algebra expression that returns the names of all authors who are not
book editors.
Write a relational algebra expression that returns the names of all authors who have at
least one publication in the database.
How many tuples are returned by the following relational algebra expression?
How many tuples will be returned by the following relational algebra query?
3. Consider two relations R1(A, B) with the tuples (1, 5), (3, 7) and R2(A, C) = (1, 7),
(4, 9). Assume that R(A,B,C) is the full naturalouter join of R1 and R2. Consider the
following tuples of the form (A,B,C)
a = (1, 5, null); b = (1, null, 7) ; c = (3, null, 9) ; d = (4, 7,null); e = (1, 5, 7) ; f = (3, 7,
null) ; g = (4, null, 9).
Which one of the following statements is correct?
(A) R contains a, b, e, f, g but not c, d
(B) R contains a, b, c, d, e, f, g
(C) R contains e, f, g but not a, b
(D) R contains e but not f, g
4. Consider the relational schema given below, where eId of the relation Dependent
is a foreign key referring to empId of the relation Employee. Assume that every
employee has at least one associated dependent in the Dependent relation.
Employee (empId, empName, empAge)
Dependent (depId, eId, depName, depAge)
Write a relational algebra query which returns the set of empIds of employees whose
age is greater than that of all of his/her dependents.
5. Consider the following relational database schema consisting of the four relation
schemas:
passenger ( pid, pname, pgender, pcity)
agency ( aid, aname, acity)
flight (fid, fdate, time, src, dest)
booking (pid, aid, fid, fdate)
Answer the following questions using relational algebra queries;
a. Get the details of flights that are scheduled on either of the dates 01/12/2020 or
02/12/2020 or both at 16:00 hours.
b. Find the agency names for agencies who do not have any bookings for passenger
with id 123.
c. Find the passenger names for those who do not have any bookings in any flights.
6. What is the optimized version of the relation algebra expression πA1(πA2 (σF1
(σF2(r)))) , where A1, A2 are sets of attributes in r with A1 ⊂ A2 and F1, F2 are
Boolean expressions based on the attributes in r?
a. πA1( σ(F1∧F2)(r))
b. πA1( σ(F1∨F2)(r))
c. πA2( σ(F1∧F2)(r))
d. πA2( σ(F1∨F2)(r))