Task: Text to Code
Input (English): Step 1: For each row in Person table, find the corresponding rows in PersonFriend table.
Step 2: find the summation of age of each value of friend in the results of step 1.
Step 3: find PersonFriend's name in the results of step 1 whose corresponding value in step 2 is greater than engineer
Output (English): SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name GROUP BY T2.friend HAVING Sum ( T1.age ) > "engineer"