Is it possible to display query results like below within mysql shell?
mysql> select code, created_at from my_records; code created_at 1213307927 2013-04-26 09:52:10 8400000000 2013-04-29 23:38:48 8311000001 2013-04-29 23:38:48 3 rows in set (0.00 sec)
instead of
mysql> select code, created_at from my_records; +------------+---------------------+ | code | created_at | +------------+---------------------+ | 1213307927 | 2013-04-26 09:52:10 | | 8400000000 | 2013-04-29 23:38:48 | | 8311000001 | 2013-04-29 23:38:48 | +------------+---------------------+ 3 rows in set (0.00 sec)
The reason I'm asking because I have some tedious task that I need to copy the output and paste it on other tool.
The Output is located at the bottom of MySQL Workbench. Its select box includes the Action Output , History Output , and Text Output options.
%s can subsitute strings, %d decimals etc.
SELECT * FROM yourTableName WHERE yourSpecificColumnName IS NULL OR yourSpecificColumnName = ' '; The IS NULL constraint can be used whenever the column is empty and the symbol ( ' ') is used when there is empty value.
--raw, -r
For tabular output, the “boxing” around columns enables one column value to be distinguished from another. For nontabular output (such as is produced in batch mode or when the --batch or --silent option is given), special characters are escaped in the output so they can be identified easily. Newline, tab, NUL, and backslash are written as \n, \t, \0, and \\. The --raw option disables this character escaping.
The following example demonstrates tabular versus nontabular output and the use of raw mode to disable escaping:
% mysql mysql> SELECT CHAR(92); +----------+ | CHAR(92) | +----------+ | \ | +----------+ % mysql --silent mysql> SELECT CHAR(92); CHAR(92) \\ % mysql --silent --raw mysql> SELECT CHAR(92); CHAR(92) \
From MySQL Docs
Not exactly what you need, but it might be useful. Add \G at the end of the query
select code, created_at from my_records\G;
Query result will look like this:
*************************** 1. row *************************** code: 1213307927 created_at: 2013-04-26 09:52:10 *************************** 2. row *************************** code: 8400000000 created_at: 2013-04-29 23:38:48
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With