Programming with SQLite


Mark Mahoney

This is a short introduction to writing programs that use SQLite. SQLite is one of my favorite programming tools. It is a full-featured relational database management system that runs 'in-process' in your favorite programming languages. This means that you do not have to have a separate database server running that your programs connect to. I am assuming the reader knows about RDBMSs and SQL. If not, there is a brief introduction to this material in chapter 1.

I start by discussing database design and basic SQL. Then I show the C/C++ API. I go over some of the low level functions and then I build an abstraction layer on top of them. Finally, I explain transactions in SQLite. Next, I discuss SQLite in the context of Python. I show how to create tables and write queries from a standalone Python program. Next, I show how one can use SQLite in a flask web app and how to create a web-based API. Lastly, I show how one can use SQLite from a Java program.

1.1 Database Design and Simple SQL
1.2 One-to-Many Relationships and More SQL
1.3 Many-to-Many Relationships and Even More SQL
2.1 The C++ SQLite API
2.2 An Object Oriented Auction Program
2.3 SQLite Transactions
3.1 Querying a SQLite Database
3.2 Creating SQLite Databases
3.3 Flask Basics (Windows)
3.4 Creating an API
4.1 Using a SQLite Database in a Java Program