[Tutor] OT - SQL methodology.

Sean Perry shaleh at speakeasy.net
Tue Mar 22 07:37:14 CET 2005

Liam Clarke wrote:
> Hi, 
> This is a SQL query for the advanced db gurus among you (I'm looking at Kent...)
> After I've run an insert statement, should I get the new primary key
> (it's autoincrementing) by using PySQLite's cursor.lastrowid in a
> select statement, or is there a more SQLish way to do this?
> In the SQL books I've got, they always seem to have an optional select
> statement on the end of inserts/updates, and I was thinking maybe I
> could do it that way also, but I can't figure out a logical way of
> putting
> 'select primary_key from foo where primary_key value > every other
> primary_key value'

select max(primary_key) from foo?

More information about the Tutor mailing list