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

3k Views Asked by At

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

1

There are 1 best solutions below

0
VLOOKUP On BEST ANSWER

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