SQLite is a database stored in memory or a single file, making it a great data structure and easy to transport.
Create a database
create table mytable (
id integer primary key autoincremenet,
first_name text,
last_name text,
email text not null
);
Read about primary keys, autoincrement, rowid: https://www.sqlite.org/autoinc.html
You may see code samples with capitalization. Many examples show integer fields using "int", but primary keys needs it spelled out as "integer primary key" for some reason.
CLI
After installing sqlite3 in your project, you can create a new database and open the terminal with:
sqlite3 database_name.db
. commands
List all commands
.help
Get create database command from schema
.schema
Change output format
.mode
Multiline commands
You can add new lines when entering commands, but when you press the up arrow to repeat a command, it only shows one line. To enter a multi line command that you can repeat, use ctrl-v ctrl-j to enter a "\n" character instead.