gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 13:25:12 25 4
gpt4 key购买 nike

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

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com