mysql_logoПосчитать таблицы базы данных MySQL можно выполнив запрос к системной БД «information_schema«.

Примеры.

//посчитать все таблицы в БД

SELECT count(*) TABLES, table_schema
FROM information_schema.TABLES
WHERE table_schema= 'YOUR DATABASE NAME'
GROUP BY table_schema;


//посчитать все таблицы в БД название которых заканчивается на parts

SELECT count(*) TABLES, table_schema
FROM information_schema.TABLES
WHERE table_schema= 'catalog' AND table_name like '%parts'
GROUP BY table_schema;

//посчитать все таблицы в БД название которых заканчивается на «parts» и на «collection»

SELECT count(*) TABLES, table_schema
FROM information_schema.TABLES
WHERE table_schema= 'catalog_test' AND table_name like '%parts' OR table_schema= 'catalog_test' AND table_name like '%collection'
GROUP BY table_schema;

//еще пример

SELECT count(*) TABLES, table_schema
FROM information_schema.TABLES
WHERE table_schema= 'catalog_test' AND table_name like '%parts%'
OR table_schema= 'catalog_test' AND table_name like '%collection'
OR table_schema= 'catalog_test' AND table_name like '%accessories%'
OR table_schema= 'catalog_test' AND table_name like '%tools'
OR table_schema= 'catalog_test' AND table_name like 'design%'
GROUP BY table_schema;