Gate2017 cs Q63

0. Consider a database that has the relation schema CR (StudentName, CourseName). An instance of the schema CR is as given below.
CR
Student NameCourse Name
SACA
SACB
SACC
SBCB
SBCC
SCCA
SCCB
SCCC
SDCA
SDCB
SDCC
SDCD
SECD
SECA
SECB
SFCA
SFCB
SFCC
The following query is made on the database.

T2 ← CR ÷ T1
The number of rows in T2 is ________.

Note – Numerical Type question

  • Option : C
  • Explanation :
    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 enroll 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 row
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *