0 votes
1 view
in SQL by (20.3k points)

It is possible to find the number of rows in a table:

select count(*) from tablename

Is it possible to find the number of columns in a table?

1 Answer

0 votes
by (40.4k points)

Try using this code:

SELECT COUNT(*)

  FROM INFORMATION_SCHEMA.COLUMNS

 WHERE table_catalog = 'database_name' -- the database

   AND table_name = 'table_name'

Related questions

0 votes
1 answer
asked Jul 11, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...