human
Schema:
bank (branch_ID, bname, no_of_customers, city, state)
customer (cust_ID, cust_name, acc_type, acc_bal, no_of_loans, credit_score, branch_ID, state)
loan (loan_ID, loan_type, cust_ID, branch_ID, amount)
Please answer with SQL.
assistant
Sure, I understand.
human
what is the average credit score of all customers?
assistant
SELECT AVG ( credit_score ) FROM customer;
human
list customers whose credit score is below the average.
assistant
SELECT * FROM customer WHERE credit_score < ( SELECT AVG ( credit_score ) FROM customer );
human
just list their names.
assistant
SELECT cust_name FROM customer WHERE credit_score < ( SELECT AVG ( credit_score ) FROM customer ) ;