Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: can wild cards be used in BETWEEN clause

Re: can wild cards be used in BETWEEN clause

From: Brian Peasland <dba_at_remove_spam.peasland.com>
Date: Tue, 13 Apr 2004 17:34:15 GMT
Message-ID: <407C2497.AFD57CD8@remove_spam.peasland.com>


SAL wrote:
>
> Hi,
> I am trying to select names of all countries from a column:
> SELECT country FROM countries_table
> WHERE
> country BETWEEN 'A%' AND 'Z%';
>
> This gives me every name except those starting with Z. I wonder if this is
> the right approach.
> Any help will be appreciated.
>
> Thanks.

But why use wildcards? Wouldn't the following query return the same thing without wildcards?

SELECT country FROM countries_table
WHERE country BETWEEN 'A' and 'ZZZ';

No wild cards needed. Especially on the first end point. If you use 'A%' then it seems to me that you want to say everything that starts with 'A' and contains any number of letters (even zero) in any combination after that. Isn't that what 'A' does by itself without wildcards?

Cheers,
Brian

-- 
===================================================================

Brian Peasland
dba_at_remove_spam.peasland.com

Remove the "remove_spam." from the email address to email me.


"I can give it to you cheap, quick, and good. Now pick two out of
 the three"
Received on Tue Apr 13 2004 - 12:34:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US