PostgreSQL - How to Describe Table

In this article, we are going to see two simple ways of executing a DESCRIBE TABLE equivalent in PostgreSQL.

1.Describe table using psql

If you want to use psql for this operation, you can enter the PostgreSQL command line and execute:

\d+ tablename

2.Describe table using SQL Syntax

select column_name, data_type, character_maximum_length, columns.is_nullable
from INFORMATION_SCHEMA.COLUMNS where table_name = 'name_of_table';

Replace name_of_table with the name of the desired table.

Share this blog post on Twitter, Facebook, and LinkedIn