Default ORDER BY in database queries Follow
Answered
Hello.
Please let me know if there's an opportunity to define a default order when viewing data from database.
When I'm choosing a table from Database Tool Window I want the data to be ordered by primary key in descending order.
In phpMyAdmin there is a TablePrimaryKeyOrder config option (https://docs.phpmyadmin.net/en/latest/config.html#cfg_TablePrimaryKeyOrder). Is there anything similar in PhpStorm?
Thanks,
Please sign in to leave a comment.
Thanks! Checked that with DataGrip team: turns out they've implemented this just recently. You can test it in EAP build:
please follow and vote for [the feature request], we consider to save sort order for a table rather then to complicate current behavior by adding special processing for UUIDs or timestamp fields.
Hi there,
I could not find any existing tickets at https://youtrack.jetbrains.com/issues/DBE (DataGrip project is home for all such DB-related tickets)
Feel free to file Feature Request for this there at Issue Tracker.
Hi,
Can you find any solution for default ordering?
No one requested this yet: no solution yet. Feel free to submit a feature request at the addressed provided earlier describing your use case in details.
Didn't find a solution.
Created a feature request just now.
Hi, what about the default ordering in db viewer? it can be useful feature, i mean id desc
Could you please elaborate? Do you want all the opened tables in given schema to be opened with e.g. first/id column sorted in descending order?
Yap, usually i need to look at last records in database, and records has id like primary key.

now default request for view:
SELECT t.*
FROM catalog.categories t
LIMIT 501
i need in all tables:
SELECT t.*
FROM catalog.categories t
ORDER BY id DESC
LIMIT 501
If it can save settings for each views with last order and column position, after moving or and sorting, and will remember in new session, it will be perfect too.
i need it for RubyMine, sorry my bad
Should be in RubyMine 2021.1 as well then.
I also wanted this but with an arbitrary column, on my case, created_at which is a timestamp, because my primary key is a UUID and it doesn't make sense to default sort by it.