How do I list all the columns in a table?

前端 未结 12 684
挽巷
挽巷 2020-12-07 07:31

For the various popular database systems, how do you list all the columns in a table?

12条回答
  •  眼角桃花
    2020-12-07 08:01

    (5 years laters, for the Honor of PostgreSQL, the most advanced DDBB of the Kingdom)

    In PostgreSQL:

    \d table_name
    

    Or, using SQL:

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

提交回复
热议问题