Sort columns alphabetically

Answered

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

8 comments
Comment actions Permalink

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.

2
Comment actions Permalink

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

4
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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.

3
Comment actions Permalink

 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
Comment actions Permalink

please upvote on YouTrack :)

1
Comment actions Permalink

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

Please sign in to leave a comment.