Only show tables with certain patterns in mysql "show tables"
There are too many tables in a db. how can I only show tables with certain pattern开发者_运维知识库s? Or is there a way I can do paging like "| more" in shell command?
show tables like 'pattern';
- use show tables like 'pattern'
- pattern is a string using wildcard characters "%","_"
- % matches any number of characters, even zero characters.
- _ matches exactly one character.
for example:
show tables like 'test%' will filter tables such as "test1,testF,test111,testFoo"
show tables like 'test_' will filter tables such as "test1,testF"
You don't have to use show tables
, you can also query information_schema.TABLES
using any filter.
In Spark SQL you need to use an asterisk symbol, SHOW tables LIKE '*table_name*
this can be used to have a glimpse of all the tables
select * from tab;
and identify the columns names. Thereafter, use
select * from tab where tname like '%D_';
精彩评论