mysql> SHOW TABLES like \'cms\'; +-------------------------+ | Tables_in_tianyan (cms) | +-------------------------+ | cms | +------------------------
You take table list using the below code
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = 'database_name'
Hope it will help you.
You need to use the WHERE
clause. As shown in the docs, you can only have a single pattern if you use "SHOW TABLES LIKE ..."
, but you can use an expression in the WHERE clause if you use "SHOW TABLES WHERE ..."
. Since you want an expression, you need to use the WHERE
clause.
SHOW TABLES
FROM `<yourdbname>`
WHERE
`Tables_in_<yourdbname>` LIKE '%cms%'
OR `Tables_in_<yourdbname>` LIKE '%role%';
show tables from mydb
where
Tables_in_mydb like '%statistics%'
or Tables_in_mydb like '%device%';
You can just use a normal SQL WHERE
statement to do it.
SHOW TABLES WHERE Tables_in_tianyan LIKE '%cms%'