Task: Text to Code
Input (English): Step 1: For each row in ACCOUNTS table, find the corresponding rows in SAVINGS table.
Step 2: find the average balance of each value of name in the results of step 1.
Step 3: find name of step 1 results with largest value in the results of step 2
Output (English): SELECT T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid GROUP BY T1.name ORDER BY Avg ( T2.balance ) Desc LIMIT 1