relational algebra to get unique pairs Let's say we are given this table of the relation Person(name, hobby)

name   hobby
bob    hockey
alice  basketball
mary   cricket
mark   basketball
rick   snowboarding
andy   hockey


How would I use relational algebra to find the hobby that had only one person had. 

It should give me

hobby
cricket
snowboarding


My ATTEMPT:

$R1 := \rho_{P2}(Person)$

$R2 := R1 \bowtie_{P2.hobby = P1.hobby \text{ } AND \text{ } P2.name &lt;&gt; P1.name} R2$

$R3 := \pi_{hobby} (R2)$
You need more carefully defined $\theta$-join and then set difference:

$$R1 := \rho_{name1/name,hobby1/hobby}(Person)$$
$$R2 := Person \bowtie_{(hobby=hobby1) \land (name \neq name1)} R1$$
$$R3 := \pi_{hobby}(Person) \setminus \pi_{hobby}(R2)$$