How do I identify all the students who have passed?
The problem you describe is known as relational division. There are basically two ways to approach it:


Transform for all x : p(x) to  not exists x :  not p(x) 


In other words, transform students who have passed all test to students where it does not exist a test that the student did not pass. Your query in the question is an example of this.

This transformation is often referred to as De Morgan's laws for quantifiers. See for example:

https://philosophy.stackexchange.com/questions/28324/proving-de-morgans-laws-for-quantifiers


Students who have passed the same amount of tests as there are tests. Something like:

 SELECT student_id
 FROM tests
 WHERE passed = 'y' 
 GROUP BY student_id
 HAVING COUNT(1) = (SELECT COUNT(DISTINCT test_id) 
                    FROM tests)



I'm answering from a mobile so I can't see the question while answering, so the details of my answer is likely wrong according to your question, but hopefully you get the idea.