Good code is well-formatted code

June 19th, 2009

It was long ago observed that efficiency of code depends on its appearance. Good code is usually readable and quickly understood by colleagues. Of course, code formatting won’t speed up the execution of your queries, but will definitely simplify finding the errors and prevent ambiguity.

Make your code standards-driven and clear for other people using formatting functionality of dbForge Studio for MySQL. Based on your needs, you can benefit from 3 types of formatting:

  • Automatic
  • Manual
  • Using SQL formatter wizard – to format multiple SQL files at once.

By default, when you finish a statement with a delimiter or paste any code fragment, they automatically formatted.

In case you want to format SQL code manually, decide whether you want to format the whole code in your script or only a statement. Use the Format Current Statement or Format Selection options from the right-click menu. The selected code will be formatted.

Use SQL Formatter wizard to format SQL code in multiple files or folders. The wizard is fully customizable, so you can tune  its formatting, based on your corporate standards.


In the top menu select Tools->Options. When the Preferences window opens, expand the Formatting node, select the required tab, and edit the rules. The New Lines, Indentation, Spacing, and Wrapping tabs allow you to preview the selected rule. To apply the rules, click OK.


Brush up your code, get more praise of your colleagues!

Comments are closed.