Programming with SQLite


Mark Mahoney

NEW! Explore Our New Platform, the Playback Press

Learn from all of your favorite code playbacks (including the ones in this book) on our brand-new site, the Playback Press.

At the Playback Press, every playback is equipped with an AI assistant that's ready to answer your questions and to test your knowledge of the material you are learning. Watch this video, "How to View a Code Playback", to see these exciting new features in action. It's like having a personal tutor right at your fingertips!

All of our books remain free of charge, check them out now!

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. This covers using SQLite in different programming languages.

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.

If you'd like to stay connected and get updates when I add new playbacks you can follow me on twitter: @markm208.

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) (Mac)
3.4 Creating an API with Flask and SQLite

4.1 Using a SQLite Database in a Java Program