Only show tables with certain patterns in mysql "show tables"

Viewed 25913

There are too many tables in a db. how can I only show tables with certain patterns? Or is there a way I can do paging like "| more" in shell command?

5 Answers
  • 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"

In Spark SQL you need to use an asterisk symbol, SHOW tables LIKE '*table_name*

Related