SHOW TABLE statement with multiple LIKE values in MySQL?


You can use WHERE clause and OR operator to show table with multiple LIKE. The syntax is as follows:

show table from yourDatabaseName
where tables_in_yourDatabaseName Like ‘%anyTableName%’
or tables_in_yourDatabaseName Like ‘%anyTableName2%’
or tables_in_yourDatabaseName Like ‘%anyTableName3%’
.
.
.
.
or tables_in_yourDatabaseName Like ‘%anyTableNameN%’

In the above syntax, only the table name in the database is displayed.

Here the database ‘test’ and the tables in the same database is considered. The query to show tables with multiple LIKE is as follows -

mysql> show tables from test
-> where tables_in_test like '%userrole%'
-> or tables_in_test like '%view_student%'
-> or tables_in_test like '%wholewordmatchdemo%';

The following is the output.

+--------------------+
| Tables_in_test |
+--------------------+
| userrole |
| view_student |
| wholewordmatchdemo |
+--------------------+
3 rows in set (0.01 sec)

Updated on: 30-Jul-2019

313 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements