jeudi 29 octobre 2015

Why or condition is working differently compare with Java and SQL

In Java,

int a = 10, b = 10;

if (a == 10 || b==10)
{
// first condition (a==10) is true, so it wont check further
}

But, in SQL,

select * from my table where a = 10 or b = 10;

--As per my understanding, It should return data only based on a.
--But it returns both entries. 

Why is that?

Aucun commentaire:

Enregistrer un commentaire