MySQL Workbench – Automatic Capitalization and Reformatting

mysql-workbench

I was editing a SQL script that I was using in MySQL Workbench 6.3. To my surprise, I noticed that one section of the code had transformed into all uppercase. I normally type in mostly lowercase with my own habits for tabs and capitalization. Somehow, a section of the code was automatically reformatted.

I am not familiar with what option caused this. Perhaps I made some sort of error in keyboarding while flipping and scrolling through a lot of code. Is there an autoformatting feature in MySQL Workbench?

How can this type of formatting be done or undone?

A sample of my code before and after follows:

Before:

select * from ReportQA_TEMPA;
select * from ReportQA_TEMPB;
select * from ReportQA_TEMPC;
select * from ReportQA_TEMPD;

After:

SELECT
*
FROM
ReportQA_TEMPA;
SELECT
*
FROM
ReportQA_TEMPB;
SELECT
*
FROM
ReportQA_TEMPC;
SELECT
*
FROM
ReportQA_TEMPD;

Best Answer

Have you looked at

Edit -> Preferences -> SQL Editor -> Query Editor? 

There are a couple of "beautifier" and "capitalise" options there.