SQLite | Commands | Changing Output Format with .mode
The SQLite CLI .mode command changes how query results are displayed.
.mode MODE ?TABLE?
| Mode | Output |
|---|---|
csv |
Comma-separated values |
column |
Left-aligned columns |
html |
HTML table rows |
insert |
SQL INSERT statements |
line |
One column = value per line |
list |
One row per line with the configured separator; default |
quote |
SQL literals separated by commas |
tabs |
Tab-separated values |
tcl |
TCL list format |
Use this sample data:
create table user (id integer, name text, address text);
insert into user values (1, 'devkuma', 'Seoul');
insert into user values (2, 'kimkc', 'Busan');
insert into user values (3, 'araikuma', 'Seoul');
Representative output:
sqlite> .mode list
1|devkuma|Seoul
2|kimkc|Busan
sqlite> .mode csv
1,devkuma,Seoul
2,kimkc,Busan
sqlite> .mode line
id = 1
name = devkuma
address = Seoul
sqlite> .mode insert
INSERT INTO "table" VALUES(1,'devkuma','Seoul');
sqlite> .mode quote
1,'devkuma','Seoul'
tabs separates values with tabs. column aligns fixed-width columns and can be adjusted with .width. html emits <TR> and <TD> elements but not the enclosing <TABLE>. tcl quotes each value as a TCL list item. Choose the format that suits export, inspection, or web output.