PyCharm
 
Get PyCharm

Sort data

Last modified: 11 October 2024

To sort column data, click a sorting icon near 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 sorting icon near the column name to sort data by, the sorting based on other columns will be cleared. If you prefer to use the stacked sorting, click the sorting icon while pressing Alt.

To change the default option for stacked sorting, open settings by pressing CtrlAlt0S 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.