postgresql: How to sort a postgresql table in a permanent way? [closed]

I am a having a table with columns id, name, and date_time. I need to sort the table according to the date_time column.

Actual data in database:

 id |   name         |         date_time
----+----------------+----------------------------
  1 | The flat       | 2022-07-06 09:17:07.990454
  2 | The Smetha     | 2022-08-08 09:17:07.990454
  3 | Kingston       | 2022-07-02 04:17:08.990454
  4 | The Oxford U   | 2022-08-08 04:14:08.990454
  5 | Studio Element | 2022-08-08 01:14:08.990454
  6 | The Davils     | 2022-08-02 04:14:08.990454
  7 | Latitude       | 2022-09-08 04:14:08.990454
  8 | Star Eight     | 2022-08-08 06:14:08.990454
  9 | Cottages one   | 2022-07-08 05:14:08.990454

I want to sort the date_time column in ASC order. But here we should not use:

SELECT * 
from table name 
ORDER BY column name;

Ex:

 id |   name         |         date_time
----+----------------+----------------------------
  1 | Kingston       | 2022-07-02 04:17:08.990454
  2 | The flat       | 2022-07-06 09:17:07.990454
  3 | Cottages one   | 2022-07-08 05:14:08.990454
  4 | The Davils     | 2022-08-02 04:14:08.990454
  5 | Studio Element | 2022-08-08 01:14:08.990454
  6 | The Oxford U   | 2022-08-08 04:14:08.990454
  7 | Star Eight     | 2022-08-08 06:14:08.990454
  8 | The Smetha     | 2022-08-08 09:17:07.990454
  9 | Latitude       | 2022-09-08 04:14:08.990454


Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)