mysql - 自定义从 dbname 显示表状态的结果

标签 mysql

执行以下查询时是否可以获得自定义结果:

show table status from dbname

我以这种方式定制了“show processlist”查询:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where time > 4 order by TIME desc;

以同样的方式,我想从上面的查询中获取自定义结果。

非常感谢您的建议...

最佳答案

在查看 information_schema 后,我得到了答案,我想在这里分享。

SELECT * FROM information_schema.tables WHERE table_schema = 'dbname';

If want to list down only some specific columns, we can mention the column names separated by comma just after SELECT key. Also, we can add filter records by adding conditions in WHERE clause. For example:

SELECT table_name,table_type,Engine,version,table_rows FROM information_schema.tables WHERE table_schema = 'jprod';

There are only two differences between below queries:

(a)show table status from dbname;
(b)SELECT * FROM information_schema.tables WHERE table_schema = 'dbname';
Query (b) provides 4 extra columns - (i) Table_catalog (ii) Table_schema (iii) Table_type (iv)Checksum
Some column names in query (a) is brief likewise table_name as name, Table_rows as rows, table_comment as comment. 

关于mysql - 自定义从 dbname 显示表状态的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20243260/

相关文章:

mysql - 错误代码 : 1648. 条件项 'MESSAGE_TEXT' 的数据太长

php - 为 CRUD 操作创建历史表的最佳方式

php - 从php更新mysql数据库中的多条记录

php - 如何在PHP中的while循环中跳过一项以从数据库显示

mysql 显示有多少个表的连接

php - 通过php在mysql中用空值更新日期时间

mysql - 将数据并发插入 MySQL 的更快方法

javascript - 对从 CSV 表生成的 HTML 表进行排序

java - 列索引无效

MySQL 按问题分组 : incompatible with sql_mode=only_full_group_by