Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE-CS-2017 (Set 1) | Question 59

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.

g20172_10

The following query is made on the database.

T1 ← πCourseNameStudentName=’SA’(CR))

T2 ← CR ÷ T1

The number of rows in T2 is ________.

Note: This questions appeared as Numerical Answer Type.

(A) 2
(B) 3
(C) 4
(D) 5


Answer: (C)

Explanation: Result of T1:
CA
CB
CC

Result of T2 = CR/T1
SA
SC
SD
SF
Total = 4
Therefore, option C is correct



Alternate Solution :
The output of query T1 will be the courses enrolled by student SA i.e CA , CB, CC

The output of query T2 will be the names of the students who enrol all the courses that are the output of query T1 (division operator) i.e CA, CB, CC
From the table we can see that SA, SC, SD, SF have enrolled all the courses so the output of T2 will have 4 rows.



This solution is contributed by parul sharma


Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads