MySQL Workbench: Display line breaks/new line

6.4k views Asked by At

The textbook 'Murach's MySQL' featured the following query:

SELECT CONCAT(vendor_name, CHAR(13,10), vendor_address1, CHAR(13,10), vendor_city, ', ', vendor_state, ' ', vendor_zip_code) AS mailing_address
FROM vendors
WHERE vendor_id = 1;

The author's output was suppose to resemble:

US Postal Service
Attn:  Supt. Window Services
Madison, WI 53707

Yet the actual output looked like the following:

US Postal Service Attn:  Supt. Window Services Madison, WI 53707

Also when I right click → Copy Row /r/n appears when I go to paste the row's content in this forum's text box

'US Postal Service\r\nAttn:  Supt. Window Services\r\nMadison, WI 53707'

char(10) represents line feed, char(13) represents carriage return.

How can I make MySQL Workbench query look like the author's output?

2

There are 2 answers

1
Joel Murach On BEST ANSWER

MySQL Workbench doesn't display the results of this query correctly in the Result Grid. To view the line breaks, you need to click on the Form Editor tab to display the results of this query in the Form Editor. If you do that, I think you'll see that the data that's returned includes the carriage return and line feed chapters and is displayed on three lines.

0
Zhenya On

I've also faced a similar issue. You could export the query results to a .csv, the data is displayed properly then.