Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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.7k 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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...