List Column Names from PostgreSQL Table

This one is a pretty simple query but I always forget 🙂

# If you want to list only the column names
select column_name from information_schema.columns where table_name='your_table_name';

# If you also want to add the data type
select column_name, data_type from information_schema.columns where table_name='your_table_name';

Â