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

标签 mysql

这不应该在 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/

相关文章:

php - 创建安全 PHP 请愿书

mysql - 我的 mysql SELECT 案例无法返回 3 列

php - 从 PHP 执行 MySQL 查询的问题

Laravel Eloquent 中的 MySQL 查询

javascript - 无法将数据从 php 返回到 JavaScript

mysql - SQL - 为同一城市的员工获取配对,并且配对中的第一个员工参加了第二个员工教授的类(class)

mysql检查2个日期与开始日期和结束日期之间有多少天有效

mysql加入多对多关系

MySQL 使用 GROUP BY 对多列进行分组

java - 第一次尝试时出现mysql连接问题