Enumerating mysql tables starting with a specific letter

How to list all tables in MYSQL database starting with "T"?

+4
source share
5 answers

Assuming MySQL 5.0:

SHOW TABLES LIKE 'T%' 

Here is the documentation

+12
source

The true ANSI way:

 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'T%' 

Does not imply the presence or behavior of a USE function. This should work in every DBMS supporting ANSI INFORMATION_SCHEMA views, which of course contain MySQL.

+7
source
 SHOW TABLES LIKE 'T%'; 
+1
source
 show tables from db_name like 't%' 
0
source

I use this internal mysql shell program:

use information_schema; select table_name from the tables where table_name, for example 't%';

0
source

All Articles