SQLite Exact match

Moderator: Rathinagiri

Post Reply
User avatar
karweru
Posts: 213
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Has thanked: 1 time
Been thanked: 10 times
Contact:

SQLite Exact match

Post by karweru »

Hi all,

How can one get SQLite to return an exact match from a query,...the equivalent of ‘==‘ ?
Kind regards,
Gilbert.

User avatar
dragancesu
Posts: 819
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 30 times
Been thanked: 233 times

Post by dragancesu »

Yes or No, depending what you want

Query result can be number, character or array, big array

If your query result is number or character answer is Yes
otherwise is No

User avatar
karweru
Posts: 213
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Has thanked: 1 time
Been thanked: 10 times
Contact:

Post by karweru »

I need for strings,

Code: Select all

 select account_code from payr where payr_code=‘c’; 
This query also returns instances where payr_code is capital ‘C’. I need it to only return small ‘c’ instances.
Kind regards,
Gilbert.

User avatar
dragancesu
Posts: 819
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 30 times
Been thanked: 233 times

Post by dragancesu »

https://sqlite.org/lang_corefunc.html

see function lower

select lower(account_code) from payr where payr_code=‘c’;

User avatar
karweru
Posts: 213
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Has thanked: 1 time
Been thanked: 10 times
Contact:

Post by karweru »

Thank you dragancesu,

Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
Kind regards,
Gilbert.

User avatar
dragancesu
Posts: 819
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 30 times
Been thanked: 233 times

Post by dragancesu »

I don't use SQLite but you can find resolve your problem

https://stackoverflow.com/questions/973 ... -comparing

SELECT * FROM ... WHERE name = 'someone' COLLATE NOCASE

User avatar
jairpinho
Posts: 404
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 5 times
Been thanked: 30 times
Contact:

Post by jairpinho »

karweru wrote:
Tue Dec 08, 2020 4:54 pm
Thank you dragancesu,

Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
Hello,


select account_code from payr where payr_code like ‘c’; or COLLATE NOCASE
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
susviela
Posts: 22
Joined: Wed Oct 17, 2018 4:44 am
DBs Used: DBF, PostgreSql, SQLite
Has thanked: 10 times
Been thanked: 2 times
Contact:

Post by susviela »

karweru wrote:
Tue Dec 08, 2020 4:54 pm
Thank you dragancesu,

Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
LIKE is no case sensitive

select * from client where name LIKE 'dan'

without the % is ==
the problem is the speed of LIKE

jayadevu
Posts: 221
Joined: Tue May 19, 2009 7:10 am
Been thanked: 11 times

Post by jayadevu »

Hi,

I am sure you must have searched in Google for an option. When I searched use of "Glob" function has come up.

Please see discussion here:
https://stackoverflow.com/questions/223 ... -sensitive

Hope that helps.

Warm regards,

Jayadev

User avatar
karweru
Posts: 213
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Has thanked: 1 time
Been thanked: 10 times
Contact:

Post by karweru »

Thank you all,

Thank you Jayadev, GLOB works perfectly. Stuff like this makes one really appreciate harbour :)
Kind regards,
Gilbert.

Post Reply