SQLite WHERE

Query that works:
SELECT * FROM mTable WHERE place = 2867

Query that does not work:
SELECT * FROM mTable WHERE code = 01.3.005

Both fields/columns are TEXT but it seems that SQLite doesn’t like the points…

Tried also

SELECT * FROM mTable WHERE code LIKE 01.3.005
or LIKE ‘01.3.005’
or LIKE “01.3.005”
or LIKE ‘%005’

Should be a syntax error…

SELECT * FROM mTable WHERE code = '01.3.005' should work.
Check that your quotes are straight quotes, curly quotes don’t work.

1 Like

I copied your straight quotes and it works,
I’m in a Mac keyboard ,I need search where these quotes are.

I’m using macOS Ventura 13.4.
System Preferences → Keyboard → Text Input - Input Sources - click button Edit… → Turn off “Use smart quotes and dashes”.

2 Likes

An absolutely prime case for why you should be using PreparedStatements and not shoving the values directly into SQL.

1 Like

Thanks Paul, I found that without changing preferences using { control ’ } then it works-

1 Like

If you type in Google :
sqlite tutorial

you will get some very useful sites…

https://www.google.com/search?client=firefox-b-d&q=sqlite+tutorial

With Ventura 13.4, my System Settings → Keyboard → Text Input - Input Sources - click button Edit…
Allows me to select straight single and double quotes from a popup menu without having to turn “Use smart quotes and dashes” off.

You are given several choices of what you want those quotes to be. Single and double designations are independent, and they both can be designated as straight.