Answer the question
In order to leave comments, you need to log in
How to issue an SQL query to PostgreSQL and substitute the value of variables there?
Help compose a sql query to search for a part of a string from the database.
everything worked like clockwork with sqlite, but in postgresql I can't deal with LIKE. How to make a request?
In my query, it only searches for the full word.
cursor.execute('SELECT * FROM tkd WHERE street_str LIKE %s AND house = %s', (street_str, house))
Answer the question
In order to leave comments, you need to log in
street_str must contain a search mask
street_str="example" - will search by equality
street_str="example%" - will search starting with example
street_str="%example" - will search ending with example
street_str="%example%" - will search for example anywhere
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question