[英]How to get only tables, not views using SHOW TABLES?
SHOW TABLES
为您提供表和视图。
如何仅检索表?
show full tables where Table_Type = 'BASE TABLE'
逐字。
或者换种说法;
show full tables where Table_Type != 'VIEW'
9岁的问题,但Google于2019年将我带到了这里
https://dev.mysql.com/doc/refman/8.0/en/show-tables.html上的链接告诉我们,我们不能同时使用LIKE和WHERE(对于MySQL 5.5.x-8.x)。
因此,该语句将引发错误(显示不是视图的表,并通过%name%进一步过滤);
show full tables like "%sometablename%" where Table_Type = 'BASE TABLE';
U必须在一个语句中选择LIKE或WHERE,而不是同时选择两者。
:::解决方案(要求您知道数据库名称(例如dbName)):::
show full tables where Tables_in_dbName like "%main%"
and Table_type = "Base Table";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.