The foods
table contains a field food_names
, in which spaces of the product name are listed using spaces, for example: beer пиво пивко пивасик
, and there can be one or more synonymous names.
I want to select all the rows in the table whose food_names
fields contain at least one word used in the query. Those. I want to make a request, for example,
SELECT * FROM foods WHERE food_names LIKE '% beer%'It turns out:
>>> import sqlite3 >>> conn = sqlite3.connect ("foods.db") >>> c = conn.cursor () >>> c.execute ("SELECT * FROM foods WHERE food_names LIKE '%?%'", ("beer")) Traceback (most recent call last): File "", line 1, in c.execute ("SELECT * FROM foods WHERE food_names LIKE '%?%'", ("beer",)) sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1. >>>
What needs to be fixed?