Count how many databases there are

0

In the system that I am putting together, the dashboard of adm shows the total number of requests, which are created for each user and within them, the requests are recorded by the tables.

Ex: User 75, has its db pedidos_75 and inside has the tables with the IDs of each request.

The question is, can you make a selection of databases and count how many have with the name starting with pedidos , as if it were a SHOW TABLES LIKE "pedidos%" and count ?

    
asked by anonymous 24.12.2017 / 01:23

1 answer

1

Try to do this:

 SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'nomeDoBanco' and TABLE_NAME like '%pedidos%';
    
24.12.2017 / 01:33