select count(*) from information_schema.`COLUMNS` where TABLE_SCHEMA='dbName' -- 数据库名 and TABLE_NAME='tablename'; -- 表名