Re: Difference between = and IN

From: Steve Kass (skass_at_drew.edu)
Date: 02/06/05


Date: Sun, 06 Feb 2005 02:21:20 -0500

The better question might be what the "sameness" is between
IN and =. They are not interchangeable at all, though they
come close if the IN list contains only one item. You would
lose nothing if only one of them were around, but they aren't
synonyms for each other. To rewrite a IN (x,y,z), you need
more than =; you need OR also.

As far as the query processor goes, it treats a IN (x,y,z)
just as if it were (a = x OR a = y OR = a = z)

Steve Kass
Drew University

Andy wrote:

>Hi
>Does anybody know what the difference is between the 'IN' and '=' operators.
> I am aware that '=' compares two expressions whereas 'IN' looks to see if an
>expression appears in a list and that a statement including an '=' operator
>is quicker to type than one with an 'IN'. Other than that I can't see that
>'=' does anything that 'IN' can't do. Is there an overhead associated with
>using the 'IN' operator?
>Thanks in advance...
>
>