Just finished Stanford lecture on SQL (by Prof. Jennifer Widom). However I have developed a confusion regarding the use of EXISTS clause. I thought it is just like a condition and an expression so that if it's true, the above query proceeds (much like the Boolean AND). So having a slight doubt regarding this question:Passenger = {pid, pname, Age}  Reservation = {pid, class, tid}and tables are populated with some data and following query is executed:SELECT pid FROM Reservation WHERE class = 'AC' AND EXISTS     (SELECT * FROM Passenger WHERE age > 65 AND Passenger.pid = Reservation.pid)Now the thing that is getting me troubled is that I thought that the use of EXISTS is simply that the above main query proceeds if the subquery returns something. So as the subquery was returning something, I expected the query to return all PID's where class = 'AC'. I didn't think that it was executed tuple by tuple. So how to remove this confusion?
Use Of Exists clause in SQL
sql;query