Sort columns alphabetically

已回答

Is it possible to force DataGrip to show columns alphabetically rather than in the order they were created?

2

There is a bit unusual way:

First, you need to assign keyboard shortcut for 'Sort lines' action. Go to File -> Settings -> Keymap,  type in search bar 'sort lines', double-click on first one and set here for example 'CTRL+ALT+W' (if you running Windows).

Second, please go to Editor -> Code style -> SQL -> <your dialect> -> Queries tab, scroll down to 'SELECT clause' section and set 'Place element on' = 'new line', 'place comma' = 'to begin'.

Now you can write a query like

SELECT * FROM TABLE_NAME;

place cursor on asterisk, hit ALT+ENTER -> expand column list, hit CTRL+ALT+L, select all column names and hit CTRL+ALT+W (shortcut defined before). You will get names sorted alphabetically.

And there is no way to sort columns in Data View when you just double-click on a table.

3

Is there any plan to make such a feature as it will be very useful with tables with 100s of columns.

4

Any updates on Dawid's request for sorting table column names in the order they are in the database table instead of alphabetically.

Appreciate Yuriy's reply but as RRSR points out, this feature should be more easily accessible.

Appreciate all your team does.

0

is there any updates for this feature? was it implemented in some versions?

also, I think that question was about sorting columns in DatabaseConsole output, not in SQL Select clause

0

that one will sort columns in database explorer:

and this one will show column list ordered (CTRL+F12 in data view), but it does not affect on actual order in data view:

and my answer was about how to sort columns in query result - just write columns in order you want them to be appeared in result set. at the moment this is the only way.

Here is similar feature request please follow and vote.

4

 just write columns in order you want them to be appeared in result set

yep, but usually we want to see all columns from table, and it's easier to navigate, when they are sorted)

voted for feature, but strange that this have not been implemented yet

 

0

please upvote on YouTrack :)

1

Upvoted. I support the issue, there is a lack of functionality for sorting columns of query results. In all previous DBMS, this functionality is available by default, for example, in the same TOAD. Here in DataGrip you have to invent crutches all the time.

0

For someone who is looking for an answer in 2024: you need to ensure that your Database window shows the Toolbar (click on three dots to see the Options), then click on the eye icon (that usually on the right). “Sort Alphabetically” option is here.

1

I would still like to be able to see the columns alphabetically in three different places:

- CTRL+B when we show source

- when double clicking the table (console results)

- when querying from table (Services window)

0

请先登录再写评论。