tags:

views:

147

answers:

5

hi, I'm new for Mysql how to list all tables in MYSQL DB starting with "T" Tx in adv

A: 
show tables from db_name like 't%'
Haim Evgi
+3  A: 

Assuming MySQL 5.0:

SHOW TABLES LIKE 'T%'

Here's the documentation

ChssPly76
A: 
SHOW TABLES LIKE 'T%';
soulmerge
A: 

I use this inside mysql shell program:

use information_schema; select table_name from tables where table_name like 't%';

rtacconi
+4  A: 

The true ANSI way:

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

Doesn't assume the presence or behaviour of the USE function. This should work in every DBMS supporting the ANSI INFORMATION_SCHEMA views, which definitely includes MySQL.

David M