Hello, I'm new to SQL and I'm having trouble with an exercise.
The exercise is based on the attached data model.
The question is:
Who (email) has never been to any show that rita@gmail.com has not been to?
What did I do :
SELECT ticket.email, show.id_espetaculo
FROM ticket ticket
JOIN show show
ON ticket.id_espetaculo = show.id_espetaculo
WHERE ticket.email != 'rita@gmail.com'
This shows me emails other than Rita's.
But it doesn't tell me which one of them didn't go to the shows that she didn't go.
SELECT ticket.email, show.id_espetaculo FROM ticket ticket JOIN show show ON ticket.id_espetaculo = show.id_espetaculo WHERE ticket.email = 'rita@gmail.com'
INTERSECT
SELECT ticket.email, show.id_espetaculo FROM ticket ticket JOIN show show ON ticket.id_espetaculo = show.id_espetaculo WHERE ticket.email != 'rita@gmail.com'