source:
vendor/python/2.5/Doc/lib/sqlite3/execsql_printall_1.py
| Last change on this file was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 350 bytes | |
| Line | |
|---|---|
| 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() |
Note:
See TracBrowser
for help on using the repository browser.
