174 views
1 1 vote

Consider

$\mathrm{STUDENT}(\mathrm{name},\mathrm{regno},\mathrm{gpa},\mathrm{level},\mathrm{dept})$

$\mathrm{COURSE}(\mathrm{cno},\mathrm{cname},\mathrm{dept})$

$\mathrm{TAKE}(\mathrm{regno},\mathrm{cno})$.

Which TRC expression returns the names of students who are not taking any course offered by the EECS department?

  1. $\{t\mid \exists s\in \mathrm{STUDENT}$
    $(t.\mathrm{name}=s.\mathrm{name}\land \neg\exists x\in \mathrm{TAKE};\exists c\in \mathrm{COURSE}(x.\mathrm{regno}=s.\mathrm{regno}\land x.\mathrm{cno}=c.\mathrm{cno}\land c.\mathrm{dept}=\mathrm{'EECS'}))\}$
     
  2. $\{t\mid \exists s\in \mathrm{STUDENT};\exists x\in \mathrm{TAKE};\exists c\in \mathrm{COURSE}$
    $(t.\mathrm{name}=s.\mathrm{name}\land x.\mathrm{regno}=s.\mathrm{regno}\land x.\mathrm{cno}=c.\mathrm{cno}\land c.\mathrm{dept}=\mathrm{'EECS'})\}$
     
  3. $\{t\mid \exists s\in \mathrm{STUDENT}$
    $(t.\mathrm{name}=s.\mathrm{name}\land s.\mathrm{dept}\neq\mathrm{'EECS'})\}$
     
  4. $\{t\mid \exists s\in \mathrm{STUDENT};\exists c\in \mathrm{COURSE}$
    $(t.\mathrm{name}=s.\mathrm{name}\land c.\mathrm{dept}\neq\mathrm{'EECS'})\}$

1 Answer

1 1 vote

Begin with a student tuple $s$.

The output must contain the student's name:

$t.\mathrm{name}=s.\mathrm{name}$.

Now describe the condition we want to exclude.

A student is taking an EECS course if there exist:

  • a $\mathrm{TAKE}$ tuple $x$
  • a $\mathrm{COURSE}$ tuple $c$

such that

$x.\mathrm{regno}=s.\mathrm{regno}$

$x.\mathrm{cno}=c.\mathrm{cno}$

and

$c.\mathrm{dept}=\mathrm{'EECS'}$.

Therefore,

$\exists x\in \mathrm{TAKE};\exists c\in \mathrm{COURSE}(\cdots)$

means the student takes at least one EECS course.

We need the opposite, so negate the entire existential condition:

$\neg\exists x\in \mathrm{TAKE};\exists c\in \mathrm{COURSE}(\cdots)$.

Hence A is correct.

B returns students who do take an EECS course.

C tests the student's own department, which is unrelated to whether the courses they take are offered by EECS.

D does not connect courses to the student at all.

Therefore,

Answer : $\boxed{\mathrm{A}}$

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
134
134 views
GO Classes asked Sep 26
134 views
Consider$\mathrm{Product}(\mathrm{pid},\mathrm{name},\mathrm{brand},\mathrm{price},\mathrm{color})$.The SQL query is:SELECT DISTINCT name FROM Product p WHERE color = 'gr...
2 2 votes
1 1 answer
91
91 views
GO Classes asked Sep 26
91 views
Consider$\mathrm{Store}(\mathrm{sid},\mathrm{store\_name},\mathrm{parent\_company})$$\mathrm{Branch}(\mathrm{sid},\mathrm{city},\mathrm{open24})$$\mathrm{Has\_Fruit}(\mat...
1 1 vote
1 1 answer
91
91 views
GO Classes asked Sep 26
91 views
Consider$\mathrm{Breeders}(\mathrm{brdr\_id},\mathrm{brdr\_name},\mathrm{age})$$\mathrm{Breeds}(\mathrm{br\_id},\mathrm{br\_name},\mathrm{friendliness})$$\mathrm{Pedigree...
1 1 vote
1 1 answer
83
83 views
GO Classes asked Sep 26
83 views
Consider $\mathrm{Pets}(\mathrm{pid},\mathrm{pname},\mathrm{weight})$.Which TRC expression returns only the weights of all pets whose name is $\mathrm{Tiny}$?$\{t\mid \ex...