[Tutor] OT - SQL methodology.

Liam Clarke cyresse at gmail.com
Tue Mar 22 07:45:09 CET 2005


Brilliant, thanks Sean. 


On Mon, 21 Mar 2005 22:37:14 -0800, Sean Perry <shaleh at speakeasy.net> wrote:
> 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?
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list