Skip to content

Instantly share code, notes, and snippets.

@MaraScott
Last active December 13, 2015 23:39
Show Gist options
  • Save MaraScott/4992933 to your computer and use it in GitHub Desktop.
Save MaraScott/4992933 to your computer and use it in GitHub Desktop.
Name : filterTable - Language : Sql - type : Select - platform : geniric - tag : filter, table
/* Filter table from a database */
/* see : http://stackoverflow.com/questions/6528531/mysql-show-tables-sort-by-table-name?answertab=votes#tab-top */
/* string $filter = filter */
/* string $dbn = database name */
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE' AND table_schema='$dbn' AND table_name LIKE '$filter'
ORDER BY table_name ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment