如何计算表格的列数

2021-11-20 00:00:00 sql mysql

例如:

tbl_ifo

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

如何使用mysql统计这个表的列数?

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

推荐答案

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

相关文章