RE: [sqlite] Using LIKE to check the first digits?

2008-02-01 Thread Griggs, Donald
Regarding: >>Indices won't help with LIKE unless the column as a NOCASE collation. Use GLOB instead: >> ... WHERE number GLOB '1234*'; >>Note that "*" is the wildcard character with GLOB, not "%" >>as in LIKE. The above will use an index on the number column if it is available.

RE: [sqlite] Using LIKE to check the first digits?

2008-02-01 Thread Samuel R. Neff
bject: Re: [sqlite] Using LIKE to check the first digits? if GLOB is so good, I am curious what are the instances in which one would prefer col LIKE '123%' over col GLOB '123*' - T

Re: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread P Kishor
On 1/31/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Gilles <[EMAIL PROTECTED]> wrote: > > At 15:40 31/01/2008 -0800, James Dennett wrote: > > > > WHERE col LIKE '123%' or WHERE substr(col,1, 3) = '123' > > > > > >The optimizer has a decent chance of using an index for LIKE '123%' but > > >I'

Re: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread Gilles
At 02:01 01/02/2008 +, [EMAIL PROTECTED] wrote: Indices won't help with LIKE unless the column as a NOCASE collation. Use GLOB instead: ... WHERE number GLOB '1234*'; Thank you for the tip. - To unsubscribe, s

Re: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread drh
Gilles <[EMAIL PROTECTED]> wrote: > At 15:40 31/01/2008 -0800, James Dennett wrote: > > > WHERE col LIKE '123%' or WHERE substr(col,1, 3) = '123' > > > >The optimizer has a decent chance of using an index for LIKE '123%' but > >I'd be surprised (and impressed) if it looks inside function calls suc

RE: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread Gilles
At 15:40 31/01/2008 -0800, James Dennett wrote: > WHERE col LIKE '123%' or WHERE substr(col,1, 3) = '123' The optimizer has a decent chance of using an index for LIKE '123%' but I'd be surprised (and impressed) if it looks inside function calls suchas substr for opportunities to use indexes.

Re: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread Scott Baker
Gilles wrote: Hello I'm no SQL guru, and need to look up phone numbers in a SQLite database that start with certain digits. Some customers use http://en.wikipedia.org/wiki/Direct_Inward_Dialing, which means that the first part is common to all the numbers assigned to this customer, so I don'

RE: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread James Dennett
> -Original Message- > From: P Kishor [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 31, 2008 3:35 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Using LIKE to check the first digits? > > On 1/31/08, Gilles <[EMAIL PROTECTED]> wrote: > > H

Re: [sqlite] Using LIKE to check the first digits?

2008-01-31 Thread P Kishor
On 1/31/08, Gilles <[EMAIL PROTECTED]> wrote: > Hello > > I'm no SQL guru, and need to look up phone numbers in a SQLite database > that start with certain digits. Some customers use > http://en.wikipedia.org/wiki/Direct_Inward_Dialing, which means that the > first part is common to all the numbers

[sqlite] Using LIKE to check the first digits?

2008-01-31 Thread Gilles
Hello I'm no SQL guru, and need to look up phone numbers in a SQLite database that start with certain digits. Some customers use http://en.wikipedia.org/wiki/Direct_Inward_Dialing, which means that the first part is common to all the numbers assigned to this customer, so I don't need to enter