MySQL : LIKE query in Database and Tables list with example

In MySQL we can able to select field values by using LIKE comment. By similarly we can list tables name and databases name using LIKE command. 

Syntax:

Listing Tables:
mysql> SHOW TABLES LIKE '<string>%';
 
Listing Databases:
mysql> SHOW DATABASES LIKE '<string>%';
</string></string>

Example:

Listing Tables:
mysql> SHOW TABLES LIKE 'feed_%';
+-----------------------------+
| Tables_in_dbexample (feed_%) |
+-----------------------------+
| feeds_importer              |
| feeds_item                  |
| feeds_log                   |
| feeds_push_subscriptions    |
| feeds_source                |
| feeds_tamper                |
+-----------------------------+
6 rows in set (0.00 sec)
 
 
Listing Databases:
mysql> SHOW DATABASES LIKE 'emp_%';
+-----------------------------+
| Databases(emp_%) |
+-----------------------------+
| emp_address                |
| emp_users                  |
| emp_payments               |
+-----------------------------+
3 rows in set (0.00 sec)
Category: