I’d like to create a MYSQL procedure that dynamically renames the headers of TABLE01 with corresponding content of TABLE02 -> the expected results is shown on TABLE03.
Here are the tables content:
    TABLE01 (EXAMPLE, THE HEADERS MIGHT CHANGE BUT THEY ARE ALWAYS INCLUDED IN TABLE02):
            id1 | BOOK | AUTHOR | YEAR |
            1|Les Miserables|Hugo|1862|
            2|Notre Dame|Hugo|1831|
            |...|...|...|
    TABLE02 (STATIC TABLE THAT STAYS UNCHANGED):
            id2 | INPUT | OUTPUT | LANGUAGE |
            1|BOOK|livre |FR|
            2|AUTHOR|auteur|FR|
            3|YEAR|annee|FR|
            4|...|...|SP|
            5|...|...|SP|
The procedure should ask for a parameter (here 'FR'), then generate TABLE 03 with the corresponding content from TABLE 02 but with updated column headers.
         TABLE03 :
            id | livre | auteur | annee |
            1|Les Miserables|Hugo|1862|
            2|Notre Dame|Hugo|1831|  
            |...|...|...|
A simple UPDATE could work but I'd like to generalize for various tables with various columns.
Thanks for your help!
EDIT 1: I have reframes the question here : Dynamically updating a table's headers with MYSQL
 
    