Previous Next JavaScript must be enabled to correctly display this content

## mode

    mode [COLUMN | LINE | JSON [-pretty] | CSV]

Sets the output mode of query results. The default value is JSON.

For example, a table shown in COLUMN mode:

    sql-> mode column;
    sql-> SELECT * from users;
     +-----+-----------+-----------+-----+
     | id  | firstname | lastname  | age |
     +-----+-----------+-----------+-----+
     |   8 | Len       | Aguirre   |  42 |
     |  10 | Montana   | Maldonado |  40 |
     |  24 | Chandler  | Oneal     |  25 |
     |  30 | Pascale   | Mcdonald  |  35 |
     |  34 | Xanthus   | Jensen    |  55 |
     |  35 | Ursula    | Dudley    |  32 |
     |  39 | Alan      | Chang     |  40 |
     |   6 | Lionel    | Church    |  30 |
     |  25 | Alyssa    | Guerrero  |  43 |
     |  33 | Gannon    | Bray      |  24 |
     |  48 | Ramona    | Bass      |  43 |
     |  76 | Maxwell   | Mcleod    |  26 |
     |  82 | Regina    | Tillman   |  58 |
     |  96 | Iola      | Herring   |  31 |
     | 100 | Keane     | Sherman   |  23 |
     +-----+-----------+-----------+-----+
     ...

    100 rows returned

Empty strings are displayed as an empty cell.

    sql-> mode column;
    sql-> SELECT * from tab1 where id = 1;
     +----+------+----+------+
     | id |  s1  | s2 |  s3  |
     +----+------+----+------+
     |  1 | NULL |    | NULL |
     +----+------+----+------+

    1 row returned

For nested tables, identation is used to indicate the nesting under column mode:

    sql-> SELECT * from nested;
    +----+-------+------------------------------------------------------------+
    | id | name  |                           details                          |
    +----+-------+------------------------------------------------------------+
    |  1 | one   | address                                                    |
    |    |       |     city    | Waitakere                                    |
    |    |       |     country | French Guiana                                |
    |    |       |     zipcode | 7229                                         |
    |    |       | attributes                                                 |
    |    |       |     color   | blue                                         |
    |    |       |     price   | expensive                                    |
    |    |       |     size    | large                                        |
    |    |       | phone       | [(08)2435-0742, (09)8083-8862, (08)0742-2526]|
    +----+-------+------------------------------------------------------------+
    |  3 | three | address                                                    |
    |    |       |     city    | Viddalba                                     |
    |    |       |     country | Bhutan                                       |
    |    |       |     zipcode | 280071                                       |
    |    |       | attributes                                                 |
    |    |       |     color   | blue                                         |
    |    |       |     price   | cheap                                        |
    |    |       |     size    | small                                        |
    |    |       | phone       | [(08)5361-2051, (03)5502-9721, (09)7962-8693]|
    +----+-------+------------------------------------------------------------+
    ...

For example, a table shown in LINE mode, where the result is displayed vertically and one value is shown per line:

    sql-> mode line;
    sql-> SELECT * from users;

     > Row 1
     +-----------+-----------+
     | id        | 8         |
     | firstname | Len       |
     | lastname  | Aguirre   |
     | age       | 42        |
     +-----------+-----------+

      > Row 2
     +-----------+-----------+
     | id        | 10        |
     | firstname | Montana   |
     | lastname  | Maldonado |
     | age       | 40        |
     +-----------+-----------+

      > Row 3
     +-----------+-----------+
     | id        | 24        |
     | firstname | Chandler  |
     | lastname  | Oneal     |
     | age       | 25        |
     +-----------+-----------+
     ...
    100 rows returned

Just as in COLUMN mode, empty strings are displayed as an empty cell:

    sql-> mode line;
    sql-> SELECT * from tab1 where id = 1;

     > Row 1
     +---------+------+
     | id      | 1    |
     | s1      | NULL |
     | s2      |      |
     | s3      | NULL |
     +---------+------+

    1 row returned

For example, a table shown in JSON mode:

    sql-> mode json;
    sql-> SELECT * from users;
    {"id":8,"firstname":"Len","lastname":"Aguirre","age":42}
    {"id":10,"firstname":"Montana","lastname":"Maldonado","age":40}
    {"id":24,"firstname":"Chandler","lastname":"Oneal","age":25}
    {"id":30,"firstname":"Pascale","lastname":"Mcdonald","age":35}
    {"id":34,"firstname":"Xanthus","lastname":"Jensen","age":55}
    {"id":35,"firstname":"Ursula","lastname":"Dudley","age":32}
    {"id":39,"firstname":"Alan","lastname":"Chang","age":40}
    {"id":6,"firstname":"Lionel","lastname":"Church","age":30}
    {"id":25,"firstname":"Alyssa","lastname":"Guerrero","age":43}
    {"id":33,"firstname":"Gannon","lastname":"Bray","age":24}
    {"id":48,"firstname":"Ramona","lastname":"Bass","age":43}
    {"id":76,"firstname":"Maxwell","lastname":"Mcleod","age":26}
    {"id":82,"firstname":"Regina","lastname":"Tillman","age":58}
    {"id":96,"firstname":"Iola","lastname":"Herring","age":31}
    {"id":100,"firstname":"Keane","lastname":"Sherman","age":23}
    {"id":3,"firstname":"Bruno","lastname":"Nunez","age":49}
    {"id":14,"firstname":"Thomas","lastname":"Wallace","age":48}
    {"id":41,"firstname":"Vivien","lastname":"Hahn","age":47}
    ...
    100 rows returned

Empty strings are displayed as "".

    sql-> mode json;
    sql-> SELECT * from tab1 where id = 1;
    {"id":1,"s1":null,"s2":"","s3":"NULL"}

    1 row returned

Finally, a table shown in CSV mode:

    sql-> mode csv;
    sql-> SELECT * from users;
    8,Len,Aguirre,42
    10,Montana,Maldonado,40
    24,Chandler,Oneal,25
    30,Pascale,Mcdonald,35
    34,Xanthus,Jensen,55
    35,Ursula,Dudley,32
    39,Alan,Chang,40
    6,Lionel,Church,30
    25,Alyssa,Guerrero,43
    33,Gannon,Bray,24
    48,Ramona,Bass,43
    76,Maxwell,Mcleod,26
    82,Regina,Tillman,58
    96,Iola,Herring,31
    100,Keane,Sherman,23
    3,Bruno,Nunez,49
    14,Thomas,Wallace,48
    41,Vivien,Hahn,47
    ...
    100 rows returned

Like in JSON mode, empty strings are displayed as "".

    sql-> mode csv;
    sql-> SELECT * from tab1 where id = 1;
    1,NULL,"","NULL"

    1 row returned

Note:

Only rows that contain simple type values can be displayed in CSV format. Nested values are not supported.