I want to describe postgres table using psql. I read this article and now I can use this structure
\d+ table_name
With this function I could display all columns and indexes related to table. But is it possible to show all table columns with specified order ? For Example I want to display columns sorted by name in desc order
You can use:
SELECT * FROM information_schema.columns
WHERE table_name = 'your_table'
ORDER BY column_name DESC;
As the documentation says:
The information schema consists of a set of views that contain information about the objects defined in the current database.
In this columns table you will find more information as
Here for a complete list