Let's create a car sales reporter as an example. We can store records of sales in an SQLite database table. SQLite is a simple file-based database engine that allows us to store records using SQL syntax. Python includes SQLite in its standard library, so there are no extra modules required.
We have two common tasks we need to perform:
- Select all sales of new vehicles and output them to the screen in a comma-delimited format
- Output a comma-delimited list of all salespeople with their gross sales and save it to a file that can be imported to a spreadsheet
These seem like quite different tasks, but they have some common features. In both cases, we need to perform the following steps:
- Connect to the database.
- Construct a ...