SQLite
SQLite’s command-line shell works out of the box. The quickest way is with the built-in profile:
extensions:
term:
profile: sqliteThis sets shell: sqlite3, prompt: "sqlite>", and ps2: " ...>". You’ll likely want to configure output formatting via init:
extensions:
term:
profile: sqlite
init:
- ".mode column"
- ".headers on"Creating Tables
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER);
INSERT INTO users VALUES (1, 'Alice', 30), (2, 'Bob', 25), (3, 'Charlie'
, 35);
Queries
SELECT * FROM users;
id name age
-- ------- ---
1 Alice 30
2 Bob 25
3 Charlie 35
SELECT name, age FROM users WHERE age > 28 ORDER BY age DESC;
name age
------- ---
Charlie 35
Alice 30
Aggregation
SELECT COUNT(*) AS total, AVG(age) AS avg_age, MIN(age) AS youngest, MAX
(age) AS oldest FROM users;
total avg_age youngest oldest
----- ------- -------- ------
3 30.0 25 35
Schema Inspection
.schema users
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER);
.tables
users