Home > front end >  How to get the columns count in a given table in SQL?
How to get the columns count in a given table in SQL?

Time:08-28

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

CodePudding user response:

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';
  • Related