Show me the names, checking balances, and savings balance for all accounts?
select t2.balance, t3.balance, t1.name from accounts as t1 join checking as t2 on t1.custid = t2.custid join savings as t3 on t1.custid = t3.custid
Also provide their total checking and saving balances?
select t2.balance + t3.balance, t2.balance, t3.balance, t1.name from accounts as t1 join checking as t2 on t1.custid = t2.custid join savings as t3 on t1.custid = t3.custid
Just show names, checking balance, saving balance but sort them by savings account balance.
select t2.balance, t3.balance, t1.name from accounts as t1 join checking as t2 on t1.custid = t2.custid join savings as t3 on t1.custid = t3.custid order by t3.balance
Actually, sort them by the total checking and savings balance FROM greatest to least.
select t2.balance, t3.balance, t1.name from accounts as t1 join checking as t2 on t1.custid = t2.custid join savings as t3 on t1.custid = t3.custid order by t2.balance + t3.balance desc