DataSpell 2023.3 Help

Sort data

To sort the column data, click the column name. By default, a new ORDER BY query is sent to the database each time you click a column name. In the Services tool window (Output tab), you can see all the corresponding sorting operations.

You can also sort the data on the client side. To do that, click the Show Options Menu button (the settings icon) and deselect the Sort via ORDER BY option.

The column sorting is not stacked by default. It means that if you click a column name to sort data by, the sorting based on other columns will be cleared. If you prefer to use the stacked sorting, click a column name while pressing Alt.

State

Description

No sorting

Indicates that the data is not sorted in this column. The initial state of the sorting marker.

Ascending order

The data is sorted in the ascending order.

Descending order

The data is sorted in the descending order.

Sorting level

The number to the right of the marker (1 on the picture) is the sorting level. You can sort by more than one column. In such cases, different columns will have different sorting levels.

To change the default option for stacked sorting, open settings by pressing Ctrl+Alt+S and navigate to Tools | Database | Data Editor and Viewer | Data Sorting. Change the value for the Add columns to sorting option.

Also, you can use the ORDER BY filter and sort data in a table by writing a query in the ORDER BY field.

Sort table data with a query

  1. In the ORDER BY field, type your query. The query syntax is the same as in the ORDER BY clause but without the keyword.

  2. Press Enter.

    To reset the filter, click the clear icon (The clear icon), or delete the contents of the row filter field and press Enter.

    To open the filter history, click the arrow icon near the ORDER BY keyword.

    WHERE and ORDER BY fields for sorting

Set default sorting by a primary key

For the tables that have a numeric primary key, DataSpell can sort the data by that key. IDE will send a new ORDER BY query to the database each time you view the table data in data editor.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Tools | Database | Data Editor and Viewer.

  2. Under Data Sorting, select Sort tables by numeric primary key.

  3. Select Ascending or Descending to set the sorting order.

  4. Click OK.

Sort table data by a numeric primary key
Last modified: 23 February 2024