mardi 13 janvier 2015

Why LIKE without wildcards does not work

I might be asking a silly question, but I really need to know. Let's imagine a query like this:



c.execute("SELECT * FROM papers WHERE topic_simple LIKE %monitor%")


This query will return all the items with monitor in the field topic_simple, including "monitoring", "monitorate", or whatever.


If I do:



c.execute("SELECT * FROM papers WHERE topic_simple LIKE monitor")


The query returns nothing, not even the items with "monitor" (as a simple word) are returned. And that bothers me, I don't understand why.


I use both the sqlite from PyQt and from sqlite3, and I have the same result.


Is there a way to get the items with "monitor" (as a simple word, whith nothing behind or in front of) with a LIKE query ?


Aucun commentaire:

Enregistrer un commentaire