0
我將選擇數據庫中所有以「_language」結尾的表。 例如:「product_language」或「category_language」。 你能幫我嗎?如何在mysql中選擇具有某些後綴的所有表?
我將選擇數據庫中所有以「_language」結尾的表。 例如:「product_language」或「category_language」。 你能幫我嗎?如何在mysql中選擇具有某些後綴的所有表?
可以使用波紋管定的查詢
SELECT
TABLE_NAME
from
information_schema.TABLES
where
TABLE_SCHEMA = 'Your_schema_name'
and TABLE_NAME LIKE '%_language';
Reference for MySQL SHOW command
可以simnply去SHOW命令,像
SHOW tables like '%_language';
然後,它會顯示選擇利用信息架構中的所有表MySQL DB中的所有表以表名結尾的名稱爲' _language」
mysql> SHOW TABLES LIKE '%_language';
輸出
+---------------------+
| Tables |
+---------------------+
| product_language |
| category_language |
+---------------------+
感謝。但它在Laravel框架中無法正常工作。我使用這個:$ tables = DB :: select('SHOW tables like「%_language」'); dd($ tables); dd($ tables);並返回:array(2){ [0] object(stdClass)#730(1){ } [1] object(stdClass)#729(1){ } – Behzad 2014-10-22 07:56:50