human
Schema:
accounts (custid, name)
savings (custid, balance)
checking (custid, balance)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the average checking balance?
assistant
SELECT AVG ( balance ) FROM checking;
human
What is the account information for those have greater checking balances than that?
assistant
SELECT * FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance > ( SELECT AVG ( balance ) FROM checking );
human
How about for lower checking balances?
assistant
SELECT * FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < ( SELECT AVG ( balance ) FROM checking ) ;