Question 1 · Database Management and Warehousing · 2026
NAT
Let Account be a relation as shown.
Account
AccNo Balance
A1 5000
A2 5000
A3 10000
A4 15000
A5 18000
Consider the given SQL query.
SELECT AccNo FROM Account AS A
WHERE (SELECT COUNT(*) FROM Account AS B
WHERE A.Balance < B.Balance) >= (SELECT COUNT(*)
FROM Account AS C WHERE A.Balance > C.Balance)
The number of rows returned by the SQL query is __________ . (Answer in integer)
Question 2 · Database Management and Warehousing · 2026
NAT
Let there be two relations X and Y as shown. X has three columns P,Q and R. Y has two columns P and S.
X
P Q R
P1 Q1 R1
P2 Q2 R2
P3 Q3 R2
Y
P S
P1 10
P1 15
P2 20
P3 1
Consider that the following tuple relational calculus expression is evaluated.
{t∣t∈X∧∃z∈X(t[P]=z[P])∧∃m∈Y(m[P]=t[P]∧m[S]>1)}
The number of tuples that will be returned is __________ . (Answer in integer)
Question 3 · Database Management and Warehousing · 2026
MSQ
Consider a table Employee(EmpID, TeamID), where the column EmpID (ID of an employee) is the primary key. The column TeamID denotes the team ID of the team of which the employee is a member. TeamID is a NOT NULL column.
We want to display the size of the team (denoted as TeamSize) in which each employee is a member by using SQL. As an example, the desired output for the given Employee table is also shown in tabular form.
Which of the following is/are correct?
Employee
EmpID TeamID
1 8
2 8
3 8
4 7
5 7
6 9
Output
EmpID TeamSize
1 3
2 3
3 3
4 2
5 2
6 1
- A. SELECT E.EmpID, B.TeamSize
FROM Employee AS E, (SELECT TeamID, COUNT(TeamID) AS TeamSize FROM Employee GROUP BY TeamID) AS B
WHERE E.TeamID = B.TeamID
- B. SELECT A.EmpID, COUNT(B.TeamID) AS TeamSize
FROM Employee AS A, Employee AS B
WHERE A.TeamID = B.TeamID AND A.EmpID = B.EmpID
GROUP BY A.EmpID
- C. SELECT B.EmpID, B.TeamSize
FROM (SELECT EmpID, COUNT(TeamID) AS TeamSize
FROM Employee GROUP BY EmpID) AS B
- D. SELECT A.EmpID, B.TeamSize
FROM Employee AS A, (SELECT COUNT(TeamID) AS TeamSize FROM Employee GROUP BY TeamID) AS B
WHERE A.TeamID = B.TeamID
Question 4 · Database Management and Warehousing · 2026
MCQ
Consider the given relations X,Y and Z. The relation X has three columns P,Q and R. The relation Y has three columns P,Q and S. The relation Z has two columns P and T.
X
P Q R
P1 Q1 R1
P2 Q2 R2
P3 Q3 R2
Y
P Q S
P1 Q1 2
P1 Q2 5
P2 Q1 6
P3 Q3 1
Z
P T
P1 T1
P3 T2
P4 T3
P4 NULL
Consider the relational algebra expression
PRS∏[(σ(Q=Q3∨R=R2)[X⋈Y])⋈(σ(S>1)[Y⋈Z])]
where ⋈ denotes natural join operation.
Which of the following options is the correct output for the given expression?
- A.
Two rows (P1, R1, 2) and (P1, R1, 5)
- B.
Three rows (P1, R1, 2), (P1, R1, 5) and (P2, R2, 6)
- C.
One row (P1, R1, 2)
- D.
Zero rows
Question 5 · Database Management and Warehousing · 2025
NAT
Consider the following tables,
Loan and
Borrower, of a bank.
| Loan |
| loan_num |
branch_name |
amount |
| L11 |
Banjara Hills |
90000 |
| L14 |
Kondapur |
50000 |
| L15 |
SR Nagar |
40000 |
| L22 |
SR Nagar |
25000 |
| L23 |
Balanagar |
80000 |
| L25 |
Kondapur |
70000 |
| L19 |
SR Nagar |
65000 |
| Borrower |
| customer_name |
loan_num |
| Anand |
L11 |
| Karteek |
L11 |
| Karteek |
L14 |
| Ankita |
L15 |
| Gopal |
L19 |
| Karteek |
L22 |
| Karteek |
L23 |
| Sunil |
L23 |
| Sunil |
L25 |
Query:
\pi_{\text{branch_name}, \text{customer_name}}(\text{Loan} \bowtie \text{Borrower}) \div \pi_{\text{branch_name}}(\text{Loan})
where
⋈ denotes natural join.
The number of tuples returned by the above relational algebra query is
(Answer in integer)
Question 6 · Database Management and Warehousing · 2025
MCQ
Consider the following three relations:
Car (model, year, serial, color)
Make (maker, model)
Own (owner, serial)
A tuple in Car represents a specific car of a given model, made in a given year, with a serial number and a color. A tuple in Make specifies that a maker company makes cars of a certain model. A tuple in Own specifies that an owner owns the car with a given serial number. Keys are underlined; (owner, serial) together form key for Own. (
⋈ denotes natural join)
πowner(Own⋈(σcolor=‘‘red′′(Car⋈(σmaker=‘‘ABC′′Make))))
Which one of the following options describes what the above expression computes?
- A.
All owners of a red car, a car made by ABC, or a red car made by ABC
- B.
All owners of more than one car, where at least one car is red and made by ABC
- C.
All owners of a red car made by ABC
- D.
All red cars made by ABC
Question 7 · Database Management and Warehousing · 2025
NAT
On a relation named Loan of a bank:
| Loan |
| loan number |
branch name |
amount |
| L11 |
Banjara Hills |
90000 |
| L14 |
Kondapur |
50000 |
| L15 |
SR Nagar |
40000 |
| L22 |
SR Nagar |
25000 |
| L23 |
Balanagar |
80000 |
| L25 |
Kondapur |
70000 |
| L19 |
SR Nagar |
65000 |
the following SQL query is executed.
SELECT L1.loan number
FROM Loan L1
WHERE L1.amount > (SELECT MAX (L2.amount)
FROM Loan L2
WHERE L2.branch name = ’SR Nagar’);
The number of rows returned by the query is (Answer in integer)
Question 8 · Database Management and Warehousing · 2024
NAT
Consider the following two tables named Raider and Team in a relational database
maintained by a Kabaddi league. The attribute ID in table Team references the
primary key of the Raider table, ID.
| Raider |
| ID | Name | Raids | RaidPoints |
| 1 | Arjun | 200 | 250 |
| 2 | Ankush | 190 | 219 |
| 3 | Sunil | 150 | 200 |
| 4 | Reza | 150 | 190 |
| 5 | Pratham | 175 | 220 |
| 6 | Gopal | 193 | 215 |
The SQL query described below is executed on this database:
SELECT *
FROM Raider, Team
WHERE Raider.ID=Team.ID AND City=“Jaipur” AND
RaidPoints > 200;
The number of rows returned by this query is ______.
| Team |
| City | ID | BidPoints |
| Jaipur | 2 | 200 |
| Patna | 3 | 195 |
| Hyderabad | 5 | 175 |
| Jaipur | 1 | 250 |
| Patna | 4 | 200 |
| Jaipur | 6 | 200 |
Question 9 · Database Management and Warehousing · 2024
MCQ
Consider a database that includes the following relations:
Defender(name, rating, side, goals)
Forward(name, rating, assists, goals)
Team(name, club, price)
Which ONE of the following relational algebra expressions checks that every name
occurring in Team appears in either Defender or Forward, where ϕ denotes the
empty set?
- A.
Πname(Team)∖(Πname(Defender)∩Πname(Forward))=ϕ
- B.
(Πname(Defender)∩Πname(Forward))∖Πname(Team)=ϕ
- C.
Πname(Team)∖(Πname(Defender)∪Πname(Forward))=ϕ
- D.
(Πname(Defender)∪Πname(Forward))∖Πname(Team)=ϕ