[Tutor] sqlite search
Prasad, Ramit
ramit.prasad at jpmorgan.com
Mon Jan 28 16:54:30 CET 2013
Alan Gauld wrote:
>
> 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!
>
Just to clarify, the '%' should go in the parameter string, not
as part of the query string. The query string should retain the '?'
(without any quotations).
~Ramit
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Tutor
mailing list