edited by
21,893 views
73 73 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 ______________ .

5 Answers

Best answer
100 100 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 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 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 .
0 0 votes
T2 states to mention the tuples who have all the courses Ca, Cb, Cc. Hence 4 tuples.
Answer:
Position:
Show:

Related questions

125 125 votes
5 answers 5 answers
43.6k
43.6k views
Arjun asked Feb 14, 2017
43,579 views
In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let $TS(T_{1})$ and $TS(T_{2})$ be the timestamps of transactions ...
71 71 votes
8 answers 8 answers
38.2k
38.2k views
Arjun asked Feb 14, 2017
38,213 views
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relatio...
97 97 votes
3 answers 3 answers
24.4k
24.4k views
Arjun asked Feb 14, 2017
24,351 views
The following functional dependencies hold true for the relational schema $R\left \{V,W,X,Y,Z \right \}$:$V \rightarrow W$$VW \rightarrow X$$Y \rightarrow VX$$Y \rightarr...
89 89 votes
12 answers 12 answers
28.7k
28.7k views
Arjun asked Feb 14, 2017
28,695 views
A cache memory unit with capacity of $N$ words and block size of $B$ words is to be designed. If it is designed as a direct mapped cache, the length of the $\textsf{TAG}$...