Skip to content
Advertisement

SQL : IN operator vs multiple ORs

There is a behaviour I would like to understand for good.

Query #1:

Output : 504

Query #2

Output : 87

Query #3

Output : 0

I want to understand why am I getting zero in the third query. Based on this, the ( , ) is equivalent to a multiple OR. Isn’t this OR inclusive ?

Advertisement

Answer

the ( , ) is equivalent to a multiple OR. Isn’t this OR inclusive ?

Sure, it’s inclusive. But it’s still an equality comparison, with no wildcard matching. It’s like writing

rather than

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement