gpt4 book ai didi

mysql - 在子查询中显示表状态?

转载 作者:可可西里 更新时间:2023-11-01 06:32:56 27 4
gpt4 key购买 nike

这不应该在 MySQL 中工作吗?

select * from (show table status like '%fubar%') as t1;

甚至

select name, rows from (show table status like '%fubar%') as t1 where rows>0;

这是我收到的错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show table status like '%fubar%') as t1' at line 1

show table foo like '%something%'show tables like '%something%' 不能以这种方式在子查询中使用吗?您还能如何从所有匹配特定模式的表中进行选择?

最佳答案

SELECT table_name as name, table_rows as rows FROM information_schema.tables as t1
WHERE table_rows > 0

这是检索您要查找的信息的另一种方法。

关于mysql - 在子查询中显示表状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6191897/

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