sqldbeavercolumn-count

How to get the columns count in a given table in SQL?


I want to get the column count in the given table in SQL. I'm using the DBeaver to do the queries.


Solution

  • Is that connected to a postgres database? Try this script see if it gives you the column count you are a looking for. Remove the aggregate function and it'll give you a lot more system related info on that table

    SELECT COUNT(Column_Name) AS ColumnCount
    FROM information_schema.columns
    WHERE table_schema = 'name of schema'
    AND table_name = 'table name';