The thing I meant to show was the ability to use the sql formatter to format your sql in the worksheet into a string for other programming languages. I'll show how to format for java here.
First here's the starting sql. You'll notice I even put in aliased column names quotes.
![](https://1.bp.blogspot.com/_HTPuwjEAZfk/SZTNNmpAcSI/AAAAAAAAAMc/930ZevW60GA/s320/screen-capture-1.png)
Now the preferences have to be changed for how to format. I'm going to try to add a simple right click -> Format to Java or something in the future but for now just change this preference.
![](https://4.bp.blogspot.com/_HTPuwjEAZfk/SZTNa4i-6LI/AAAAAAAAAMk/7Ne2MkOciIs/s320/screen-capture-2.png)
Now a quick format.
![](https://1.bp.blogspot.com/_HTPuwjEAZfk/SZTNsQghOeI/AAAAAAAAAMs/IHimEPjRJVc/s320/screen-capture-3.png)
And the sql query is properly escaped and ready to be copy-n-pasted into your favorite java code.
![](https://4.bp.blogspot.com/_HTPuwjEAZfk/SZTNxujXeBI/AAAAAAAAAM0/UUC7WrJAAWU/s320/screen-capture-4.png)