Lite output

When you interact with SQLite in a shell-like environment you are able to query a database directly from the terminal. With the SELECT keyword, for instance, you can study a table and inspect the values of the rows stored in a well-designed schema.

SELECT "title", "system" FROM "public.games"
WHERE "developer" = 'Squaresoft'
ORDER BY "year", "title";

The output of the statement is immediate and formatted with a specific mode, but you can change the appearance. To do this type in .mode and complete the line with one of the supported alternatives, without semicolons. The instruction is for SQLite only, not a regular query.

There are fifteen options — almost too many —, but here’s an example.

.mode list
title|system
Makai Toushi Sa-Ga|GB
Seiken Densetsu 2|SNES
Front Mission|SNES
Seiken Densetsu 3|SFC
Bahamut Lagoon|SNES
Front Mission Series: Gun Hazard|SNES
Chocobo no Fushigi na Dungeon|PS1
Einhander|PS1
Chocobo Racing: Genkai e no Road|PS1
Chrono Cross|PS1
DewPrism|PS1
Racing Lagoon|PS1
Seiken Densetsu: Legend of Mana|PS1

And should you be stuck, or just fancy a new point of view, here a few notes:

  • the default mode is "list"

    Columns are divided with the pipe character | and rows break on multiple lines.

  • "ascii" is a good way to stress test the size of the window

    Snarky comment aside, the output is processed in a single line, while columns and rows are separated with obscure ASCII marks.

  • "quote" surrounds the values in quotes, while "box" presents the data in a good-looking frame

    The two are so precious to spawn a third option, "qbox", which combines the features and even wraps long lines of text to ease the reading

  • "markdown" structures the data similarly to a box, but with the same characters and sequences expected by the extension of the markdown language

    Some systems lean on the syntax to preview the values with a much greater appeal.

  • "table" works as a spruced-up version of markdown, with fancy plus characters + for the corners of the cells

    Despite the name, the string won’t create an HTML table, but for that you have another mode, "html".

    The output is quite more elaborate, it might also need a parent table container, but it certainly saves you the time to write out the tags yourself.

  • "column" resembles an increasingly outdated paper bill, one you could receive at a checkout register to double-check the twenty cents discount

  • "csv" and "json" let you structure the data in the matching standards, with comma separated values and a giant array

  • "insert" engineers the SQL queries you would need to insert the values in a new dataset

    You refine the mode with one extra argument, the name of the table, but the effort is worth it and convenient as with HTML

There are more modes, each with its own form and niche use, but for any and all remaining worries, SQLite has the answer in the .help command.

.help .mode

Input the code and you find all the options, summarized and detailed to solve all problems and save the day.