Task: Text to Code
Input (English): Step 1: For each row in visit table, find corresponding rows in museum table and in visitor table.
Step 2: find the summation of Total_spent of each value of visit's Museum_ID in the results of step 1.
Step 3: find visitor_ID, visitor's Name, Num_of_Staff of the results of step 1 with largest value in the results of step 2
Output (English): SELECT T3.visitor_ID , T2.Name , T1.Num_of_Staff FROM museum AS T1 JOIN visitor AS T2 JOIN visit AS T3 ON T1.Museum_ID = T3.Museum_ID AND T3.visitor_ID = T2.ID AND T1.Museum_ID = T3.Museum_ID GROUP BY T3.Museum_ID ORDER BY Sum ( T3.Total_spent ) Desc LIMIT 1