edited by
12,776 views
52 votes
52 votes

Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.
$$\begin{array}{|c|c|} \hline \textbf{StudentName} & \textbf {CourseName} \\\hline \text {SA} &  \text{CA} \\\hline \text{SA} & \text{CB}\\\hline \text{SA} & \text{CC} \\\hline \text{SB} & \text{CB} \\\hline \text{SB}& \text{CC} \\\hline \text{SC} & \text{CA}\\\hline \text{SC}&\text{CB} \\\hline \text{SC} & \text{CC} \\\hline \text {SD} &  \text{CA} \\\hline \text{SD} & \text{CB}\\\hline \text{SD} & \text{CC} \\\hline \text{SD} & \text{CD} \\\hline \text{SE}& \text{CD} \\\hline \text{SE} & \text{CA}\\\hline \text{SE}&\text{CB} \\\hline \text{SF}& \text{CA} \\\hline \text{SF} & \text{CB }\\\hline\text{SF} & \text{CC} \\\hline \end{array}$$
The following query is made on the database.

  • $T1 \leftarrow \pi _{CourseName}\left ( \sigma _{StudentName=SA}\left ( CR \right ) \right )$
  • $T2 \leftarrow CR\div T1$

The number of rows in $T2$ is ______________ .

edited by

5 Answers

Best answer
72 votes
72 votes

ANS) 4

T1 WILL GIVE :- $\begin{array}{|c|c|c|} \hline \text {1. CA} \\\hline  \text {2. CB} \\\hline  \text {3. CC} \\\hline \end{array}$

T2 = CR $\div$  T1 $=$ All the tuples in CR which are matched with every tuple in T1 : $\begin{array}{|c|c|c|} \hline \text {1. SA} \\\hline  \text {2. SC} \\\hline  \text {3. SD} \\\hline \text{4. SF} \\\hline \end{array}$

//SB IS NOT MATCHED WITH CASE IS NOT MATCHED WITH CC 

edited by
0 votes
0 votes
Be executing query on T1 → CA,CB,CC

T2 <--CR/T1  ,So ans will be those Student name having T1(i.e CA,CB,CC(all 3)) ,So studend name -->SA,SC ,SD,SF  contains T1 &lsquo;s 3 course name ,so answer will be 4 .
0 votes
0 votes
Be executing query on T1 we get -->CA,CB,CC

T2 = CR/T1  ,So ans will be those Student name having T1( i.e CA,CB,CC(all 3)) ,So student name -->SA,SC ,SD,SF  contains T1&rsquo;s  all 3 course name ,so answer will be 4 .
Answer:

Related questions

48 votes
48 votes
2 answers
1