ago
77 views
0 0 votes

Consider

$\mathrm{Student}(\mathrm{sid}, \mathrm{sname}, \mathrm{major})$

$\mathrm{EnrolledIn}(\mathrm{sid}, \mathrm{cid}, \mathrm{grade})$

$\mathrm{Course}(\mathrm{cid}, \mathrm{cname}, \mathrm{dept}, \mathrm{credits})$

Which expression returns the $\mathrm{sid}$ values of students enrolled in all Computer Science courses?

  1. $\pi_{\mathrm{sid}}(\mathrm{EnrolledIn}) \div \pi_{\mathrm{cid}}\left(\sigma_{\mathrm{dept}=\text{'Computer Science'}}(\mathrm{Course})\right)$
     
  2. $\pi_{\mathrm{sid}}\left(\mathrm{EnrolledIn} \bowtie \sigma_{\mathrm{dept}=\text{'Computer Science'}}(\mathrm{Course})\right)$
     
  3. $\pi_{\mathrm{sid},\mathrm{cid}}(\mathrm{EnrolledIn}) \div \pi_{\mathrm{cid}}(\mathrm{Course})$
     
  4. $\pi_{\mathrm{sid},\mathrm{cid}}(\mathrm{EnrolledIn}) \div \pi_{\mathrm{cid}}\left(\sigma_{\mathrm{dept}=\text{'Computer Science'}}(\mathrm{Course})\right)$

2 Answers

0 0 votes

The required set is :

every course belonging to the Computer Science department.

Therefore, the divisor must be:

$\pi_{\mathrm{cid}}\left(\sigma_{\mathrm{dept}=\text{'Computer Science'}}(\mathrm{Course})\right)$

The numerator must contain pairs:

$(\mathrm{sid}, \mathrm{cid})$

showing which student is enrolled in which course:

$\pi_{\mathrm{sid},\mathrm{cid}}(\mathrm{EnrolledIn})$

Therefore:

$\pi_{\mathrm{sid},\mathrm{cid}}(\mathrm{EnrolledIn}) \div \pi_{\mathrm{cid}}\left(\sigma_{\mathrm{dept}=\text{'Computer Science'}}(\mathrm{Course})\right)$

returns the $\mathrm{sid}$ values that are paired with every Computer Science $\mathrm{cid}$.

Hence D is correct.

A removes $\mathrm{cid}$ before division, so the required association cannot be tested.

B finds students enrolled in some Computer Science course.

C finds students enrolled in every course in the university.
 

Answer : A

ago
1 flag:
✌ Edit necessary (divyanshu_create “Well, D should be the correct one but at last Answer is mentioned as A. Kindly check it”)
0 0 votes

Admin has mistakenly stated answer to be A, but he has proved answer to be D. Anyways, if people are confused regarding it here is the explanation of the question's proof :
1. We are given the table information and we need to derive the statement students enrolled in Computer Science Students Courses.  

2. Analysing the first option A, we get
                              Sid(EnrolledIn) / Cid(dept = "computer science"(Course))

Well, the division can't be performed as the divisor misses cid to perform the division. So further we can't move to any conclusion as the process itself performed is in a wrong way.

3. Analysing option B,

                              Project SId (EnrolledIn natural Join dept = "Computer science" (Course))

It projects the Sid of the ones in other courses as well with atleast one being of Computer Science department. Thus, its also not the one we want.

4. Analysing option C, 

                            sid, cid (EnrolledIn) / cid (Course)iw

This perform the division correctly but there's no selection of the department that means it returns the Sid of all the courses where at least one student is enrolled within the university. Therefore, it also fails to satisfy the statement or meet up the statement of the question.

5. Analysing option D,

                         sid, cid(EnrolledIn) / cid ( select where department = "Computer Science"(Course))
Cid shall get cancelled and thus results in the return of Sid's of all the ones enrolled in Computer Science courses. Therefore this is the answer. 

Admin let me know if my explanation went wrong somewhere.....

ago
Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
148
148 views
GO Classes asked 4 days ago
148 views
Consider$\mathrm{Player}(\mathrm{playerID}, \mathrm{name}, \mathrm{position}, \mathrm{height}, \mathrm{weight}, \mathrm{team})$$\mathrm{Game}(\mathrm{gameID}, \mathrm{hom...
0 0 votes
1 1 answer
64
64 views
GO Classes asked 4 days ago
64 views
Let $\mathrm{R}(\mathrm{X},\mathrm{Y})$ and $\mathrm{S}(\mathrm{Y})$.Which expression is equivalent to $\mathrm{R} \div \mathrm{S}$ without using the division operator?$\...
0 0 votes
1 1 answer
60
60 views
GO Classes asked 4 days ago
60 views
Consider$\mathrm{Suppliers}(\mathrm{SID}, \mathrm{sname}, \mathrm{address})$$\mathrm{Parts}(\mathrm{PID}, \mathrm{pname}, \mathrm{color})$$\mathrm{Catalog}(\mathrm{SID}, ...
0 0 votes
1 1 answer
54
54 views
GO Classes asked 4 days ago
54 views
Consider$\mathrm{Student}(\mathrm{snum},\mathrm{sname},\mathrm{major},\mathrm{level},\mathrm{age})$$\mathrm{Class}(\mathrm{name},\mathrm{meets\_at},\mathrm{room},\mathrm{...