This lesson demonstrates how to execute SQLite SELECT Query from Python to retrieve rows from the SQLite table using the built-in module sqlite3.
Goals of this lesson
- Fetch all rows using a
cursor.fetchall() - Use
cursor.fetchmany(size)to fetch limited rows, and fetch only a single row usingcursor.fetchone() - Use the Python variables in the SQLite Select query to pass dynamic values.
Also Read:
Table of contents
Prerequisite
Before executing the following program, please make sure you know the SQLite table name and its column details.
For this lesson, I am using the ‘SqliteDb_developers’ table present in my SQLite database.