>>>import sqlite >>>x = sqlite.connect('mysqlitedb') >>>cx = x.cursor()
>>>cx.execute( 'create table foo (columnA varchar(15), columnB number(3))' ) >>>cx.execute ('insert into foo (columnA, columnB) values ("Parrot", 90)') >>>x.commit() >>>cx.execute('select * from foo') >>>cx.fetchall() [('Parrot', 90)] >>>cx.execute('insert into foo (columnA, columnB) values ("Sketch", 120)' ) >>>cx.execute('select * from foo') >>>cx.fetchall() [('Parrot', 90), ('Sketch', 120)] >>>cx.execute('select * from foo where columnB < 100') >>>cx.fetchall() [('Parrot', 90)] The key part to all of that is the SQL in the execute statements. I recommend http://www.sqlcourse.com/ which was recommended to me by Alan. Oh, and don't forget the c.commit() part! That had me running around in circles all night last night. Regards, Liam Clarke PS Anyone know if there's a way to get a list of tables in a DB? I've got the pragma to get a list of columns in a table, but just in the off chance... On Mon, 21 Feb 2005 10:38:31 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Mon, 21 Feb 2005, Chris Mallari wrote: > > > hi there! can u pls send me sample code in accessing a simple database > > using python. > > Hi Chris, > > You may want to look at the Database topic guide: > > http://www.python.org/topics/database/ > > It has links to examples, tutorials, and other documentation. > > _______________________________________________ > Tutor maillist - Tutor@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. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor