-- Database schema
| ACCOUNTS : custid [ INT ] primary_key , name [ TEXT ] | SAVINGS : custid [ INT ] primary_key SAVINGS.custid = ACCOUNTS.custid , balance [ INT ] | CHECKING : custid [ INT ] primary_key CHECKING.custid = ACCOUNTS.custid , balance [ INT ] |
-- -- Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.

SELECT T1.name ,  T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T3.balance  >  (SELECT avg(balance) FROM savings);