From eab940567c9207c6852f96f2e5ed13f787ddc313 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sat, 10 Jun 2017 09:31:37 -0500 Subject: [PATCH] Add Show Tables That Match A Pattern as a mysql til --- README.md | 3 ++- mysql/show-tables-that-match-a-pattern.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mysql/show-tables-that-match-a-pattern.md diff --git a/README.md b/README.md index 8a7b1b6..7c32e02 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_539 TILs and counting..._ +_540 TILs and counting..._ --- @@ -235,6 +235,7 @@ _539 TILs and counting..._ - [Display Output In A Vertical Format](mysql/display-output-in-a-vertical-format.md) - [Dump A Database To A File](mysql/dump-a-database-to-a-file.md) - [List Databases And Tables](mysql/list-databases-and-tables.md) +- [Show Tables That Match A Pattern](mysql/show-tables-that-match-a-pattern.md) - [Show Indexes For A Table](mysql/show-indexes-for-a-table.md) ### Phoenix diff --git a/mysql/show-tables-that-match-a-pattern.md b/mysql/show-tables-that-match-a-pattern.md new file mode 100644 index 0000000..4cbcdb9 --- /dev/null +++ b/mysql/show-tables-that-match-a-pattern.md @@ -0,0 +1,19 @@ +# Show Tables That Match A Pattern + +An unfamiliar database with tons of tables can be a difficult thing to +navigate. You may have an idea of the kind of table you are looking for +based on a domain concept you've seen elsewhere. + +You can pare down the results returned by `show tables` by including a +`like` clause with a pattern. For example, this statement will show me only +tables that have the word `user` in them: + +```sql +> show tables like '%user%'; ++-------------------------------+ +| Tables_in_jbranchaud (%user%) | ++-------------------------------+ +| admin_users | +| users | ++-------------------------------+ +```