查找表中的列数

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

我想知道是否可以找到表中的行数和列数.

I would like to know if it's possible to find the number of both rows and columns within a table.

SELECT COUNT(*)
FROM tablename

推荐答案

SELECT COUNT(*)
  FROM INFORMATION_SCHEMA.COLUMNS
 WHERE table_catalog = 'database_name' -- the database
   AND table_name = 'table_name'

相关文章