0

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;
1
  • Tables don't have variables, they have columns
    – user1822
    Commented May 11, 2020 at 9:52

1 Answer 1

1

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';
1
  • 1
    You can add order by ordinal_position to get the correct order
    – user1822
    Commented May 11, 2020 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.