Relational Algebra

Question 1
The following relation records the age of 500 employees of a company, where empNo ( indicating the employee number) is the key:

empAge(\underline{empNo},age)

Consider the following relational algebra expression:

\Pi_{empNo}(empAge \Join_{(age > age1)} \rho_{empNo1,age1}(empAge))

What does the above expression generate?
A
Employee numbers of only those employees whose age is the maximum
B
Employee numbers of only those employees whose age is more than the age of exactly one other employee
C
Employee numbers of all employees whose age is not the minimum
D
Employee numbers of all employees whose age is the minimum
GATE CSE 2021 SET-1   Database Management System
Question 2
Consider the following relation P(X, Y, Z), Q(X, Y, T) and R(Y, V):

How many tuples will be returned by the following relational algebra query?

Answer:______
A
1
B
2
C
3
D
4
GATE CSE 2019   Database Management System
Question 3
Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query
Q:r \Join (\sigma _{B\lt 5}(s))
Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.
Which one of the following queries is NOT equivalent to Q?
A
\sigma _{B \lt 5}(r\Join s)
B
\sigma _{B\lt 5}(r LOJ s)
C
r LOJ(\sigma _{B\lt 5}(s))
D
\sigma _{B\lt 5}(r) LOJ s
GATE CSE 2018   Database Management System
Question 4
Consider a database that has the relation schema CR (StudentName, CourseName). An instance of the schema CR is as given below.

The following query is made on the database

T1\leftarrow \pi _{CourseName}(\sigma _{StudentName='SA'}(CR))
T2\leftarrow CR\div T1

The number of rows in T2 is ____________.
A
2
B
3
C
4
D
5
GATE CSE 2017 SET-1   Database Management System
Question 5
Given the relations
employee (name, salary, dept-no), and
department (dept-no, dept-name,address),
Which of the following queries cannot be expressed using the basic relational algebra operations \left(\sigma, \pi,\times ,\Join, \cup, \cap,-\right)?
A
Department address of every employee
B
Employees whose name is the same as their department name
C
The sum of all employees' salaries
D
All employees of a given department
ISRO CSE 2016   Database Management System
Question 6
Consider the join of a relation R with a relation S. If R has m tuples and S has n tuples then the maximum and minimum sizes of the join respectively are
A
m+n and 0
B
mn and 0
C
m+n and |m-n|
D
mn and m+n
ISRO CSE 2016   Database Management System
Question 7
Consider the relational schema given below, where eId of the relation dependentis a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation.

The above query evaluates to the set of empIds of employees whose age is greater than that of
A
some dependent
B
all dependents
C
some of his/her dependents
D
all of his/her dependents
GATE CSE 2014 SET-3   Database Management System
Question 8
What is the optimized version of the relation algebra expression \pi _{A1}(\pi _{A2}(\sigma _{F1}(\sigma_{F2}(r)))) , where A1, A2 are sets of attributes in r with A_{1}\subset A_{2} and F1, F2 are Boolean expressions based on the attributes in r?
A
\pi _{A1}(\sigma_{(F1 \wedge F2)}(r))
B
\pi _{A1}(\sigma_{(F1\vee F2)}(r))
C
\pi _{A2}(\sigma_{(F1\wedge F2)}(r))
D
\pi _{A2}(\sigma_{(F1 \vee F2)}(r))
GATE CSE 2014 SET-3   Database Management System
Question 9
Consider a join (relation algebra) between relations r(R)and s(S) using the nested loop method. There are 3 buffers each of size equal to disk block size, out of which one buffer is reserved for intermediate results. Assuming size(r(R))\ltsize(s(S)), the join will have fewer number of disk block accesses if
A
relation r(R) is in the outer loop.
B
relation s(S) is in the outer loop
C
join selection factor between r(R) and s(S) is more than 0.5.
D
join selection factor between r(R) and s(S) is less than 0.5
GATE CSE 2014 SET-2   Database Management System
Question 10
Consider the following relations A, B and C:

How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A\cupB is the same as that of A.
(A\cup B)\bowtie _{A.Id \gt 40 \vee C.Id \lt 15}C
A
7
B
4
C
5
D
9
GATE CSE 2012   Database Management System
There are 10 questions to complete.

Leave a Comment

Like this FREE website? Please share it among all your friends and join the campaign of FREE Education to ALL.