执行以下查询时是否可以获取自定义结果:
show table status from dbname
我以这种方式定制了“show processlist”查询:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where time > 4 order by TIME desc;
以同样的方式,我想从上面的查询中获取自定义结果。
非常感谢你的建议......
答案 0 :(得分:1)
在浏览了information_schema之后,我得到了我想在这里分享的答案。
SELECT * FROM information_schema.tables WHERE table_schema = 'dbname';
如果只想列出一些特定的列,我们可以在SELECT键之后提及用逗号分隔的列名。此外,我们可以通过在WHERE子句中添加条件来添加过滤器记录。例如:
SELECT table_name,table_type,Engine,version,table_rows FROM information_schema.tables WHERE table_schema = 'jprod';
以下查询之间只有两个不同之处:
(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.