I’ve used the sqlite3 CLI for a decade with .mode column .headers on. It’s functional and fine. Today a coworker’s screen had this gorgeous ASCII-table output and I went “what is that?”

.mode box
.headers on

The box mode produces properly bordered tables:

┌────┬──────────────┬─────────────┐
│ id │     email    │  created_at │
├────┼──────────────┼─────────────┤
│ 1  │ a@b.com      │ 2023-01-02  │
│ 2  │ c@d.com      │ 2023-01-05  │
└────┴──────────────┴─────────────┘

Unicode box characters. Works in modern terminals. Makes ad-hoc SQL exploration much more pleasant than the squished column mode.

Other modes worth knowing:

  • .mode markdown — output ready to paste into a Markdown doc.
  • .mode table — similar to box but with ASCII chars, for old terminals.
  • .mode json — structured output, pipe to jq.

Putting .mode box in ~/.sqliterc is now permanent. I don’t know why it isn’t the default.