Re: IN or BETWEEN

From: Mark <markg_at_mymail.co.uk>
Date: 23 Apr 2002 07:37:17 -0700
Message-ID: <ddb31653.0204230637.57f0f6d2_at_posting.google.com>


Ola!

To answer your question, in your example, IN and BETWEEN will behave different.

x_column IN (0,1) will check to see if the value in x_column is literally in the list you supply, ie, x_column can either be 0 OR 1. A value of 0.1 will fail.

x_column BETWEEN 0 AND 1 will allow any number between 0 and 1, so a number of 0.5, 0.456, 0.1 etc is valid

Hope that helps,

Adios,

M

miotromailcarlos_at_netscape.net (Carlos) wrote in message news:<1de5ebe7.0204230113.42cd2d4d_at_posting.google.com>...
> Hello everyone.
> I am designing a DB with Oracle Designer. When I add 'allowable
> values' for a column I have two choices:
> 1.- Adding values separately (i.e: adding '0' as a 'allowable value'
> and then adding '1' as another 'allowable value'). This will generate
> a check constraint of type IN ( x_column IN (0,1)).
> 2.- Adding values by intervals (i.e: adding '0' as a 'allowable value'
> with '1' as 'high value'). This will generate a check constraint of
> type BETWEEN ( x_column BETWEEN 0 AND 1 ).
> I always assumed that expresions of type 'BETWEEN' are quicker than
> expressions of type 'IN' (at least talking in Oracle terms).
> Am I right in this assumption?
> And yet another question: Do expresions of type 'BETWEEN' work like
> expresions with <= and >= or not?
> Thanks in advance and regards from Spain.
Received on Tue Apr 23 2002 - 16:37:17 CEST

Original text of this message