mercredi 20 juillet 2016

Will exists clause compare the records?

I have two tables as

tb1(field1 int) containing 1,2,3,4
tb2(field2 int) containing 4,12,19,30

When I run

select * from tb1 where exists(select * from tb2 ); 

I'm getting the entire values from tb1. Why it's so? I thought that the it will bring only 4 as it is present in both tables. Now I'm totally confused with the exists clause. I want to know what the exists clause is doing here ? Please help me.

Aucun commentaire:

Enregistrer un commentaire