Search code examples
sqlmysqlcolumn-count

How do I count columns in a table


For example :

id | name  | age | gender 
----------------------------
1  | John  |  15 |  Male
2  | Maria |  18 |  Female
3  | Steph |  19 |  Female
4  | Jay   |  21 |  Male

How can I count the columns of this table using mysql?


Solution

  • SELECT count(*)
    FROM information_schema.columns
    WHERE table_name = 'tbl_ifo'