[英]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.