69 views
0 0 votes

Consider

$\mathrm{Student}(\mathrm{snum},\mathrm{sname},\mathrm{major},\mathrm{level},\mathrm{age})$

$\mathrm{Class}(\mathrm{name},\mathrm{meets\_at},\mathrm{room},\mathrm{fid})$

$\mathrm{Enrolled}(\mathrm{snum},\mathrm{cname})$

$\mathrm{Faculty}(\mathrm{fid},\mathrm{fname},\mathrm{deptid})$

Which relational algebra construction returns the names of students who have taken every course taught by Elizabeth Taylor?

  1. $\mathrm{ET}=\rho_{\mathrm{ET}(\mathrm{cname})}\left(\pi_{\mathrm{name}}\left(\sigma_{\mathrm{fname}=\text{'Elizabeth Taylor'}}(\mathrm{Class}\bowtie\mathrm{Faculty})\right)\right)$
    $\mathrm{SE}=\pi_{\mathrm{sname},\mathrm{cname}}(\mathrm{Student}\bowtie\mathrm{Enrolled})$
    $\mathrm{Result}=\mathrm{SE}/\mathrm{ET}$
     
  2. $\mathrm{ET} = \pi_{\mathrm{fname}}\left(\sigma_{\mathrm{fname}=\text{'Elizabeth Taylor'}}(\mathrm{Faculty})\right)$
    $\mathrm{Result} = \pi_{\mathrm{sname}}(\mathrm{Student}) / \mathrm{ET}$

  3. $\mathrm{Result} = \pi_{\mathrm{sname}}\left(\mathrm{Student} \bowtie \mathrm{Enrolled} \bowtie \sigma_{\mathrm{fname}=\text{'Elizabeth Taylor'}}(\mathrm{Faculty})\right)$
     
  4. $\mathrm{ET}=\pi_{\mathrm{name}}(\mathrm{Class})$
    $\mathrm{Result}=\pi_{\mathrm{sname},\mathrm{cname}}(\mathrm{Student}\bowtie\mathrm{Enrolled})/\mathrm{ET}$

1 Answer

0 0 votes

Division answers a query of the form:

Find every $X$ that is associated with every required $Y$.

Here:

  • $X = \mathrm{student\ name}$

  • $Y = \mathrm{course\ taught\ by\ Elizabeth\ Taylor}$

First determine exactly the required courses:

$\mathrm{ET} = \rho_{\mathrm{ET}(\mathrm{cname})}\left(\pi_{\mathrm{name}}\left(\sigma_{\mathrm{fname}=\text{'Elizabeth Taylor'}}(\mathrm{Class} \bowtie \mathrm{Faculty})\right)\right)$

The rename is important because the divisor attribute must correspond to $\mathrm{cname}$.

Next construct the student-course pairs:

$\mathrm{SE} = \pi_{\mathrm{sname},\mathrm{cname}}(\mathrm{Student} \bowtie \mathrm{Enrolled})$

Now,

$\mathrm{SE} / \mathrm{ET}$ returns each $\mathrm{sname}$ that occurs with every $\mathrm{cname}$ in $\mathrm{ET}$.

Thus A is correct.

C requires only at least one course taught by Elizabeth Taylor, not every such course.

D incorrectly requires students to have taken every course in the complete $\mathrm{Class}$ relation.


Answer : A

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
163
163 views
GO Classes asked Sep 23
163 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
2 2 answers
107
107 views
GO Classes asked Sep 23
107 views
Consider$\mathrm{Student}(\mathrm{sid}, \mathrm{sname}, \mathrm{major})$$\mathrm{EnrolledIn}(\mathrm{sid}, \mathrm{cid}, \mathrm{grade})$$\mathrm{Course}(\mathrm{cid}, \m...
0 0 votes
1 1 answer
81
81 views
GO Classes asked Sep 23
81 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
74
74 views
GO Classes asked Sep 23
74 views
Consider$\mathrm{Suppliers}(\mathrm{SID}, \mathrm{sname}, \mathrm{address})$$\mathrm{Parts}(\mathrm{PID}, \mathrm{pname}, \mathrm{color})$$\mathrm{Catalog}(\mathrm{SID}, ...