Sort columns alphabetically Follow Answered Dawid Nawrot Created February 26, 2020 09:01 Is it possible to force DataGrip to show columns alphabetically rather than in the order they were created?
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.
Is there any plan to make such a feature as it will be very useful with tables with 100s of columns.
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.
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
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.
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
please upvote on YouTrack :)
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.