select count(*) from information_schema.columns where table_schema='db' and table_name='tb' db是表所在的数据库名称,tb是要查询的表名