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 states are the customers from?
assistant
SELECT distinct state FROM customer;
human
For each state, how many customers have a credit score above 100?
assistant
SELECT COUNT( * ) , state FROM customer WHERE credit_score > 100 GROUP BY state;
human
find their total account balances.
assistant
SELECT SUM( acc_bal ) , state FROM customer WHERE credit_score > 100 GROUP BY state ;