How can I create a friendly view from MySQL query results like this image's examples to propose questions here, at stackoverflow, that are relationated with MySQL database problems.

I don't even know if friendly view is the correct term for this. But every time that I have to show my mysql table's data, I draw this information manualy.

I do something like this:

id_auto | name | type
1, john, person

I would like to do like the following examples:

enter image description here

enter image description here

  • I know this is a dumb question, but a search a lot and couldn't find any answer for this. Basically, I would like to produce data sample in this example's format from my pre existing mysql tables.

1 Answers

Jim Grant On Best Solutions

Taken from the MySQL website.

5.6.1 Table Format

The table format is used by default for printing result sets when MySQL Shell is in interactive mode. The results of the query are presented as a formatted table for a better view and to aid analysis.

To get this output format when running in batch mode, start MySQL Shell with the --result-format=table command line option (or its alias --table), or set the MySQL Shell configuration option resultFormat to table.

mysql-sql> select * from limit 3;
| actor_id | first_name  | last_name      | last_update          |
|        1 | PENELOPE    | GUINESS        | 2006-02-15 4:34:33   |
|        2 | NICK        | WAHLBERG       | 2006-02-15 4:34:33   |
|        3 | ED          | CHASE          | 2006-02-15 4:34:33   |