[sqlite] Re: LIKE operator syntax for white space
Yuriy Martsynovskyy <[EMAIL PROTECTED]> wrote: How do I filter out records that contain WHITE SPACE in a field or have this field empty? For example: select * from mytable where fld <> "" and fld LIKE . fld <> '' and not (fld LIKE '% %') -- that's percent space percent Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: like operator
Hi, Will Sqlite uses indexes when using the like operator as below, select * from tbl where '9845' like column || '%' order by des limit 1; regards ragha ** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! * - Original Message - From: Igor Tandetnik <[EMAIL PROTECTED]> Date: Friday, August 17, 2007 7:25 am Subject: [sqlite] Re: like operator > RaghavendraK 70574 > <[EMAIL PROTECTED]> wrote: > > we have given a web interface which receive delete request. > > Now in the req we get "%" and in the delete impl we do this > > delete from table where itemName like xxx.%; > > > > since the key is % the above statement becomes, > > "delete from table where itemName like %.%";And result in fatal > > problem of erasing all records. > > Try > > delete from table > where itemName >= 'xxx.' and itemName < 'xxx/'; > > (a slash '/' character happens to come after period '.' in ASCII). Or > > delete from table > where substr(itemName, 1, length('xxx.')) = 'xxx.'; > > The first query would run much faster than the second if you have > an > index on itemName. > > Igor Tandetnik > > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: like operator
Hi, Thanks for the reply. I could not under the "/" what is the purpose of it? regards ragha ** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! * - Original Message - From: Igor Tandetnik <[EMAIL PROTECTED]> Date: Friday, August 17, 2007 9:55 am Subject: [sqlite] Re: like operator > RaghavendraK 70574 > <[EMAIL PROTECTED]> wrote: > > we have given a web interface which receive delete request. > > Now in the req we get "%" and in the delete impl we do this > > delete from table where itemName like xxx.%; > > > > since the key is % the above statement becomes, > > "delete from table where itemName like %.%";And result in fatal > > problem of erasing all records. > > Try > > delete from table > where itemName >= 'xxx.' and itemName < 'xxx/'; > > (a slash '/' character happens to come after period '.' in ASCII). Or > > delete from table > where substr(itemName, 1, length('xxx.')) = 'xxx.'; > > The first query would run much faster than the second if you have > an > index on itemName. > > Igor Tandetnik > > > --- > -- > To unsubscribe, send email to [EMAIL PROTECTED] > --- > -- > > - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: like operator
RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: we have given a web interface which receive delete request. Now in the req we get "%" and in the delete impl we do this delete from table where itemName like xxx.%; since the key is % the above statement becomes, "delete from table where itemName like %.%";And result in fatal problem of erasing all records. Try delete from table where itemName >= 'xxx.' and itemName < 'xxx/'; (a slash '/' character happens to come after period '.' in ASCII). Or delete from table where substr(itemName, 1, length('xxx.')) = 'xxx.'; The first query would run much faster than the second if you have an index on itemName. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -