Small. Fast. Reliable. Choose any three.  In-Memory Databases
An SQLite database is normally stored in a single ordinary disk
file. However, in certain circumstances, the database might be
stored in memory.  The most common way to force an SQLite
database to exist purely in memory is to open the database using
the special filename ":memory:". In other words, instead of
passing the name of a real disk file into one of the
sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2()
functions, pass in the string ":memory:". For example:  rc =
sqlite3_open(":memory:", &db);  When this is done, no disk file
is opened. Instead, a new database is created purely in memory.
The database ceases to exist as soon as the database connection
is closed. Every :memory: database is distinct from every other.
So, opening two database connections each with the filename
":memory:" will create two independent in-memory databases.  The
special filename ":memory:" can be used anywhere that a database
filename is permitted. For example,