I have a database $db_name that contains a slew of tables. Many of them contain the name 'puzzle' (for example: 'puzzle1', 'puzzle2', 'puzzle3', etc.). What command do I need to perform to count all of those tables and return an integer?
Asked
Active
Viewed 45 times
-2
-
1In addition to the duplicate above you would add the filter ``AND `TABLE_NAME` LIKE 'puzzle%'`` to the `WHERE` clause. – Pinke Helga Feb 20 '19 at 14:49
1 Answers
1
Pretty sure your answer is in here: How do I get list of all tables in a database using TSQL? Only extra thing is to get these in an array, check if it applies to your conditions (e.g. starts with "puzzle") and then return the total number of items you're left over with.

Brent Meeusen
- 179
- 1
- 11
-
-
If the link above isn't working, try the following SQL statement: `SELECT table_name FROM information_schema.tables where table_schema='your_database_name';` (from https://stackoverflow.com/questions/8334493/get-table-names-using-select-statement-in-mysql) – Brent Meeusen Feb 20 '19 at 14:35
-
This is a comment or close vote / flag (possible duplicate), not an answer. – Pinke Helga Feb 20 '19 at 14:35