I need to sample all the tables in a MySQL database, for example through SELECT * ... LIMIT 10
.
I already have the code that returns all the tables in the current database:
select table_name from information_schema.tables where table_schema = database();
The following (incorrect) query illustrates what I want to do:
Select * from (
select table_name from information_schema.tables where table_schema = database()
) limit 10;
, which would function as:
Select * from tabela1 limit 10;
Select * from tabela2 limit 10;
...
Select * from tabelaN limit 10;
How can I do this in a single query?
I found examples that speak of cursors, but I'm not sure how I could apply them in this case.
I saw a very similar example in SQL Server using cursors, but I could not adapt it to MySQL.