Find the number of columns in a table

前端 未结 19 2249
Happy的楠姐
Happy的楠姐 2020-11-27 11:13

It is possible to find the number of rows in a table:

select count(*) from tablename

Is it possible to find the number of columns in a tabl

19条回答
  •  -上瘾入骨i
    2020-11-27 11:41

    SELECT TABLE_SCHEMA
        , TABLE_NAME
        , number = COUNT(*) 
    FROM INFORMATION_SCHEMA.COLUMNS
    GROUP BY TABLE_SCHEMA, TABLE_NAME;
    

    This one worked for me.

提交回复
热议问题