[Tutor] sqlite search

Alan Gauld alan.gauld at btinternet.com
Sun Jan 27 19:21:27 CET 2013


On 18/01/13 18:11, Roger wrote:

> At the moment this works to search for everything beginning with A
> sql = "SELECT * FROM plants WHERE genus LIKE 'A%'";
> cursor.execute(sql);

SQLlite supports a form of format string where you put in some magic 
charactrs then provide arguments which SQLLite will substitute in your 
SQL statement.

You can see examples of that in the database topic in my tutorial:

file:///home/alang/Documents/HomePage/tutor/tutdbms.htm

Look at the address book example near the end for the 'Find Entry' 
feature, and definitely read the 'word about security' subheading for 
the correct way to do it!

hth
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list