Default ORDER BY in database queries

已回答

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,

2

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.

0
Avatar
Permanently deleted user

Hi,

Can you find any solution for default ordering?

0

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.

0
Avatar
Permanently deleted user

Didn't find a solution.

Created a feature request just now.

0
Avatar
Permanently deleted user

Hi, what about the default ordering in db viewer? it can be useful feature, i mean id desc 

 
0

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?

0
Avatar
Permanently deleted user

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


0
Avatar
Permanently deleted user

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.

0

Thanks! Checked that with DataGrip team: turns out they've implemented this just recently. You can test it in EAP build:

4
Avatar
Permanently deleted user

i need it for RubyMine, sorry my bad

0

Should be in RubyMine 2021.1 as well then.

0

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.

0

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.

1

请先登录再写评论。