Postgresql – How to get all column names of a table in in multiple rows

postgresqlquery

I have used the following to just view the column names of a table (without any values) Is there a way to view all column names in one column but separate rows? Maybe do a lateral join? Open for suggestions. It is for exploratory purposes only.

This is what I used so far:

select *
from fi.questionnaire
where false;

Best Answer

The folling query will provide one column, where each column name of the respective table is displayed in a separate row. The order seems random.

select column_name
from information_schema.columns
where table_name = 'questionnaire'
  and table_schema = 'fi';