# Queries

> **TL;DR**
> `File | Settings | Editor | Code Style | SQL | <sql_dialect> | Queries` for Windows and Linux
>
>
>
> `IntelliJ IDEA | Settings | Editor | Code Style | SQL | <sql_dialect> | Queries` for macOS
>
>
>
> `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) ![the Settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)
>
>
>
> As <sql_dialect>, select the SQL dialect on the [Code Style. SQL](settings-code-style-sql.html) page.

Configure code style for `INSERT`, `UPDATE`, `WITH`, `SELECT`, `FROM`, and other query structures.

Use this page to configure formatting  options for SQL files. When you change these settings, the Preview pane shows how this will affect your code.

## Common

| Item | Description |
| --- | --- |
| Align the first word of clause | Align keywords to the left or right margin of the first word of a statement section (for example, `SELECT`). The To left with indent option aligns all keywords except for `WITH`, `UNION`, and `INTERSECT` along the left margin with the indent.       * To left ![To left](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_first_clause_to_left.png)    * To left with indent ![To left with indent](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_first_clause_to_left_with_indent.png)    * To right ![To right](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_first_clause_to_right.png)    |
| Place clause elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).  |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.      |
| Collapse short statements | Join multiline short statements. The length of a statement that will be collapsed is determined automatically by IntelliJ IDEA. To enable this option only for subqueries, select Subqueries only.   |
| Keep section elements under section header | Move all section elements under the section main keyword (a header). |
| Align section elements | Align elements of a clause section.       * Enabled ![Align section elements is on](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_section_elements_on.png)    * Disabled ![Align section elements is off](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_section_elements_off.png)    |
| Align line comments at right of elements | Align line comments that are on the right side of code.  |

## INSERT statement and VALUES clause

| Item | Description |
| --- | --- |
| Place INTO on the new line | Move `INTO` and clause elements that follow `INTO` on a new line. |
| Place INTO clause elements on | Move clause elements that follow `INTO` on a new line.      The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Place VALUES clause elements (rows) on | Move clause elements that follow `VALUES` on a new line.      The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Place the opening parenthesis |  Align or indent the opening parenthesis under the first keyword on the line. Select On the same line to keep the opening parenthesis on the line with the keyword.  |
| Place columns or values | Change the position of elements in relation to the opening parenthesis.        * Same line aligned: align all members of the clause, keep the first member on the same line with a parenthesis.    * Wrapped unindented: move all members of the clause to a new line without adding an indent.    * Wrapped aligned: align and move all members of the clause to a new line.    * Wrapped indented: add an indent and move all members of the clause to a new line.     |
| Place the closing parenthesis |    Change the position of the closing parenthesis.       * At the end: place the closing parenthesis at the same line with the last element of a clause.    * To begin: move the closing parenthesis to a new line with the last element of a clause.    * Under opening: place the closing parenthesis under the opening parenthesis.    * Under elements: place the closing parenthesis under aligned elements of a clause.    |
| Wrap columns or values | Move objects to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.     |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.         * To begin ![To left](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_place_comma_to_begin.png)    * To end ![To left with indent](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_place_comma_to_end.png)      The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab. .    |
| Put spaces within parentheses | Add a space after the opening parenthesis and before the closing parenthesis. |
| Collapse short multi-row values | Place all statements on a single line.       * Enabled ![All statements are placed on a single line](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_collapse_short_multirow_values_on.png)    * Disabled ![Statements are placed on several lines](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_collapse_short_multirow_values_off.png)    |
| Align multi-row VALUES |  Choose the most suitable width for the `VALUES` columns. For the values that are much longer than others, move the remaining fields to the next row.  |

## UPDATE statement

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).       The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Wrap elements | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.        The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.    |
| Align `=` | Align all equal signs (`=`).       * Enabled ![All equal signs are aligned](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_equal_sign_on.png)    * Disabled ![Equal signs are not aligned](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_equal_sign_off.png)    |

## WITH clause

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).       The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Wrap subqueries | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.     |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.      The In the middle option joins two lines of code on one line.      If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.       The Place comma option works only if the Wrap subqueries option in the WITH clause section is set to Chop or Chop if long.      The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.        * To begin ![To begin](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_with_clause_place_comma_to_begin.png)    * In the middle ![In the middle](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter__with_clause_place_comma_in_middle.png)    * To end ![To end](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_with_clause_place_comma_to_end.png)    |
| Align AS |    Align all `AS` keywords.        * Enabled ![Align all AS keywords feature is enabled](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_as_enabled.png)    * Disabled ![Align all AS keywords feature is disabled](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sql_formatter_align_as_disabled.png)    |

## SELECT clause

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).       The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.    |
| Wrap elements | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.        The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| New line after ALL, DISTINCT | Add a new line after `ALL` and `DISTINCT`. |
| Keep elements on one line if ≤ | Set the maximum number of elements on one line. |
| Use AS | Always use `AS` for aliases. |
| Align AS |    Align all `AS` keywords.    |

## FROM clause

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).     The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.    |
| Wrap elements | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.        The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Wrap the first JOIN | Move the first `JOIN` in the `SELECT` statement to a new line. |
| Wrap the next JOIN | Move the second `JOIN` in the `SELECT` statement to a new line. |
| Indent JOIN | Add an indent before the `JOIN` clause. |
| Place JOIN in join-only queries under | Select the element according to which you want to align the `JOIN` clause.       * Table (as usual): align to the table name.    * FROM indented: align to the right margin of `FROM` with an indent.    * FROM: align to the left margin of `FROM`.    |
| Align joined tables | Align table names in `JOIN` clauses. |
| Align table aliases | Align table aliases in `JOIN` clauses. |
| Wrap ON/USING | Move `ON` and `USING` to a new line. |
| Place ON/USING under | Align `ON` and `USING` to the table name (Table), or align to the table name and add an indent (Table indented). |

## WHERE and HAVING clauses

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).     The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.    |
| Wrap elements | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    |
| Place top-level AND/OR | Move AND and OR to the end (To end) or to the beginning (To begin) of a clause. |
| Align AS |    Align all `AS` keywords.    |

## GROUP BY and ORDER BY clauses

| Item | Description |
| --- | --- |
| Place elements on |  Move clause elements to a new line (New line) or leave them on the same line (Same line).     The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.    |
| Wrap elements | Move elements to a new line.        * Chop: move each value to a new line.    * Chop if long: move each value to a new line if the text exceeds the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    * Wrap if long: break a section of text into lines so that each line fits the configured line length. To configure the line length, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) , navigate to `Editor \| Code Style` , and type the necessary length in the Hard wrap at N columns field.    |
| Place comma |    Move a comma (`,`) to the beginning (To begin) or to the end (To end) of a code line.      The Auto option analyzes the surrounding context and calculates the most suitable place for a comma. For example, you have three occurrences of a comma: two commas go at the beginning, one comma is at the end. The Auto option will move the third occurrence of the comma to the beginning. This option works only if you have more than three cases in a single context. Otherwise, commas are left as is.       If you want to disable a new line after the comma when the To begin option is enabled, clear the Line breaks checkbox on the Wrapping tab.        The As in common option means that the behavior of the selected option must duplicate the behavior of the analogous option in the Common section on the Queries tab.     |
| Align ASC/DESC | Align all `ASC` and `DESC` keywords. |

## Subquery

| Item | Description |
| --- | --- |
| Place the opening parenthesis |  Align or indent the opening parenthesis under the first keyword on the line. Select On the same line to keep the opening parenthesis on the line with the keyword.  |
| Place subquery | Change the position of elements in parentheses.        * Same line aligned: align all members of the clause, keep the first member on the same line with a parenthesis.    * Wrapped unindented: move all members of the clause to a new line without adding an indent.    * Wrapped aligned: align and move all members of the clause to a new line.    * Wrapped indented: add an indent and move all members of the clause to a new line.     |
| Place the closing parenthesis |    Change the position of the closing parenthesis.       * At the end: place the closing parenthesis at the same line with the last element of a clause.    * Unindented: move the closing parenthesis to a new line without an indent.    * To begin: move the closing parenthesis to a new line with the last element of a clause.    * Under opening: place the closing parenthesis under the opening parenthesis.    * Under elements: place the closing parenthesis under aligned elements of a clause.    |
| Put spaces within parentheses | Add a space after the opening parenthesis and before the closing parenthesis. |

## See also

### Procedures

[Code style schemes](configuring-code-style.html)

