Name

.mode — Set the output mode

Common Usage

.mode (column[s]|csv|html|insert|line[s]|list|tabs|tcl) [table-name]

Description

The .mode command sets the output mode. This determines how the output data is formatted and presented. The optional table name is only used by the insert mode. The default mode is list. Supported modes include:

column

Output is in a tabular format, with one row per line. The width of each column is defined by the values provided by the .width command. Output will be clipped to fit into the column width. If headers are on, the first two lines will be the column names, followed by separator dashes. In most cases, this is the easiest format for humans to read, assuming the column widths are set to something useful.

csv

Output is in comma-separated values, with one row per line. Each value is separated by a single comma character with no trailing space. If headers are on, the first line will be the set of column names. If a value contains a comma, the value will be enclosed in double quotes. If the value contains a double quote character, the SQL rules for escaping quotes will be used and the literal double quote will be replaced with two double quote characters in sequence. This is not what many CSV importers expect, however.

html

Output is in an HTML table format. Each database row will be output as a <tr> element (table row). If headers are on, the first table row element will contain the column names. For older versions of HTML, the output is suitable to place within ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.