= Solution
Find the salesperson identifiers satisfying each price condition using <relational selection> and <relational projection>:
$$
L=\pi_{\mathsf{salespersonid}}(\sigma_{\mathsf{price}=10000}S),\qquad H=\pi_{\mathsf{salespersonid}}(\sigma_{\mathsf{price}=30000}S).
$$
Intersect these identifier sets, <relational join> the result to the salesperson records, and apply <relational projection> to names:
$$
\boxed{\pi_{\mathsf{name}}\left(P\bowtie_{\mathsf{empid=salespersonid}}(L\cap H)\right).}
$$
If intersection is not a primitive of the chosen <relational algebra>, use $L\cap H=L-(L-H)$ with <relational difference>. There is no need to access `Car`: the <foreign key> already ensures that every sale refers to a car.
Intersecting names instead of identifiers is wrong. Two different salespeople called Alex, one making only $10000$ sales and the other only $30000$ sales, would make Alex appear in both name sets although neither person satisfies the condition. Nor can one sale satisfy both price tests: the two distinct prices require distinct sale records.
Back to article page