| 1 | import sqlite3 |
| 2 | |
| 3 | # Create a connection to the database file "mydb": |
| 4 | con = sqlite3.connect("mydb") |
| 5 | |
| 6 | # Get a Cursor object that operates in the context of Connection con: |
| 7 | cur = con.cursor() |
| 8 | |
| 9 | # Execute the SELECT statement: |
| 10 | cur.execute("select * from people order by age") |
| 11 | |
| 12 | # Retrieve all rows as a sequence and print that sequence: |
| 13 | print cur.fetchall() |