0

assume I have 4 assignment with assignmentID:A1,A2,A3,A4 in a assignment table and following table:

GroupID GraderName assigmentID
  1         TA1        A1
  2         TA2        A2
  3         TA1        A4
  4         TA1        A3
  5         TA1        A1
  6         TA2        A4
  7         TA3        A3
  8         TA3        A2
  9         TA3        A1
  10        TA2        A1
  11        TA1        A2

Report name of the grader that mark at least one group for every assignment. From my table, it should report TA1. TA2 didnt mark any A3 and TA3 didnt mark any A4 thus ignore them. Can someone suggest a approach using relational algebra operator such as cross join , natural join, self join, etc....

uselpa
  • 18,732
  • 2
  • 34
  • 52
boxy
  • 139
  • 1
  • 7
  • Why join? School assignment? (GROUP BY is the way to go, probably combined with HAVING and COUNT(DISTINCT. – jarlh Feb 02 '15 at 08:34
  • See [this](https://stackoverflow.com/questions/24423150/relational-algebra-for-banking-scenario/24425914?s=1|3.6447#24425914). Also give a reference to *your* "relational algebra" or examples of the operators *you* are supposed to use because *there are many variations* and *we don't know which one you are supposed to use unless you tell us*. – philipxy Feb 11 '15 at 09:31

1 Answers1

0

From the relational algebra perspective I would suggest to find all assignments first: π_assignmentID(assignment). Then, to answer your question you should use division, ÷, i.e., the query should be

π_{GraderName,assignmentID}(assignment) ÷ π_assignmentID(assignment)

If for whatever reason you do not like using division you can always replace by a repeated difference.

Alexander Serebrenik
  • 3,567
  • 2
  • 16
  • 32