How can I get information about the used tables from the processed query?

The previous programmer left me with a "beautiful" piece of code, and he kind of forgot to apply something to it. There is a query that selects multiple items from multiple tables.

6 Items can be selected. This means that 6 tables can be selected, however there can be more tables - even 20 of them. I need to get this list of tables from a processed query.

Indeed, is it possible at all? Is there any command for getting a list of tables that used a query?
+1


source to share


1 answer


I'm not sure if I understand the question correctly, but it might be helpful to "explain" the query and see which tables are being used as shown below.



EXPLAIN SELECT * FROM table1 JOIN table2 USAGE (id)

+2


source







All Articles