SQL
October 4, 2023SQL
October 4, 2023SQL
Question 26

A table ‘student’ with schema (roll, name, hostel, marks), and another table ‘hobby’ with schema (roll, hobbyname) contains records as shown below:
Table: Student ROLL NAME HOSTEL MARKS 1798 Manoj Rathod 7 95 2154 Soumic Banerjee 5 68 2369 Gumma Reddy 7 86 2581 Pradeep Pendse 6 92 2643 Suhas Kulkarni 5 78 2711 Nitin Kadam 8 72 2872 Kiran Vora 5 92 2926 Manoj Kunkalikar 5 94 2959 Hemant Karkhanis 7 88 3125 Rajesh Doshi 5 82 Table: hobby ROLL HOBBYNAME 1798 chess 1798 music 2154 music 2369 swimming 2581 cricket 2643 chess 2643 hockey 2711 volleyball 2872 football 2926 cricket 2959 photography 3125 music 3125 chess
The following SQL query is executed on the above tables:
select hostel from student natural join hobby where marks >= 75 and roll between 2000 and 3000;
Relations S and H with the same schema as those of these two tables respectively contain the same information as tuples. A new relation S’ is obtained by the following relational algebra operation:
S’ = ∏_{hostel} ((σ_{s.roll = H.roll}(σ_{marks > 75 and roll > 2000 and roll < 3000} (S)) X (H))
The difference between the number of rows output by the SQL statement and the number of tuples in S’ is
6


4


2


0

Question 26 Explanation:
SQL query will return:
Total 7 rows are selected.
Where in relational algebra only distinct values of hostels are selected,i.e., 5, 6, 7 (3 rows).
∴ Answer is 7 – 3 = 4
Total 7 rows are selected.
Where in relational algebra only distinct values of hostels are selected,i.e., 5, 6, 7 (3 rows).
∴ Answer is 7 – 3 = 4
Correct Answer: B
Question 26 Explanation:
SQL query will return:
Total 7 rows are selected.
Where in relational algebra only distinct values of hostels are selected,i.e., 5, 6, 7 (3 rows).
∴ Answer is 7 – 3 = 4
Total 7 rows are selected.
Where in relational algebra only distinct values of hostels are selected,i.e., 5, 6, 7 (3 rows).
∴ Answer is 7 – 3 = 4
Subscribe
Login
0 Comments