0

I am just starting with functions and it seems like I went a bit over my head with this one) So for example I need to execute SELECT * FROM <table> query. I need this query to be executed for all tables I have. And list of table names is just another table, so to get all table names I have to execute SELECT table_names FROM meta_table_info How can I do this for many tables using some sort of cycle?

Thank you beforehand.

Vlad Vlad
  • 530
  • 1
  • 5
  • 17
  • 2
    So what to you want to do with the content of all those tables (=the result of all SELECTs) –  May 20 '22 at 09:44
  • @a_horse_with_no_name Hello! I am not sure yet, but for starters maybe just combine results together in a new table, or at least display those results just for debuging purposes. – Vlad Vlad May 20 '22 at 09:46
  • But they have different column count and column types... – Laurenz Albe May 20 '22 at 10:21
  • @LaurenzAlbe Hello! For the sake of argument lets pretend that all of those tables are equal. I am just trying to get the concept of looping select query over several tables. – Vlad Vlad May 20 '22 at 10:23
  • 1
    My recommendation is that you pick a different, more realistic problem to train your skills on. Weird requirements like that tend to have weird, complicated solutions that do not really help the learner. – Laurenz Albe May 20 '22 at 10:42
  • maybe you can try using function for loop to select the same table multiple times. – jian May 20 '22 at 10:55
  • Found answer here https://stackoverflow.com/questions/24618672/function-to-loop-through-and-select-data-from-multiple-tables – Vlad Vlad May 20 '22 at 11:17

0 Answers0