Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to get column count in SQL?

1 Answer

0 votes
by (119k points)

Here is the SQL query to count the number of columns in Employee table:

SELECT count (column_name) as Number 

FROM information_schema.columns 

WHERE table_name='Employee' 

Here is the SQL query to get the list of all the columns of Employee table:

SELECT column_name,table_name as Number 

FROM information_schema.columns

WHERE table_name = ‘Employee’

Here is the SQL query to get the list of all the columns of tables in the database:

SELECT column_name,table_name as Number 

FROM information_schema.columns

If you want to learn SQL and writing SQL queries, then check out this SQL Course by Intellipaat that provides Instructor-led training, certification, and also job assistance.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 6, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked May 5, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked May 3, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Apr 22, 2020 in SQL by Sudhir_1997 (55.6k points)

Browse Categories

...