DEV Community

Discussion on: How to write SQL queries which are easier to read?

Collapse
 
manicsquirrel profile image
Carla Lewis 🐿️

I'm of the opinion that using a formatter can actually familiarize the developer with accepted formatting guidelines. They reinforce uniformity.

While not everyone can afford a Red Gate formatter, I've had good experiences with architectshack.com › Poor Man's T-SQL Formatter which has a free plug-in for SSMS.

Collapse
 
bergamin profile image
Guilherme Taffarel Bergamin

VSCode also has it. Good enough. Great for when your console spits out a huge query in one line

Collapse
 
javinpaul profile image
javinpaul

Yes, a formatter is a good option and it can also give consistency. Does VSCode has by default or there is any extension/plugins?

Thread Thread
 
bergamin profile image
Guilherme Taffarel Bergamin

Now you've got me. I'm not sure if from a plugin.

I've been using this one for SQL Server:

github.com/microsoft/vscode-mssql

And this one for other (recent project, not so many contributors, so not yet so full of features):

github.com/mtxr/vscode-sqltools

If select query and right click doesn't show a "format code/file", it probably comes from one of these.