There are many ways to query for all-occurrences interactions. This appendix utilizes the PostgreSQL EXISTS() function, which is useful when the result of the query does not need any columns from the SAMPLES table. A regular join would work as well.
Example B.1. Finding all the all-occurrences interactions
SELECT *
FROM actor_actees
WHERE EXISTS(SELECT 1
FROM samples
WHERE samples.sid = actor_actees.sid
AND (samples.sname = actor_actees.actor
OR samples.sname = actor_actees.actee);