Task: Text to Code
Input (English): SQL: SELECT Avg ( T2.credit_score ) FROM bank AS T1 JOIN customer AS T2 ON T2.branch_ID = T1.branch_ID JOIN loan AS T3 ON T1.branch_ID = T3.branch_ID WHERE T3.loan_type = "Mortgages"
Feedback: Not only loan type equals Mortgages but also every other loan type in loan table .
Output (English): SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)