human
Schema:
accounts (custid, name)
savings (custid, balance)
checking (custid, balance)
Please answer with SQL.
assistant
Sure, I understand.
human
Whose savings balance is lower than their checking balance?
assistant
SELECT T1.name 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 < T2.balance;
human
What is the total balance of 'Weeks' Checking and savings.
assistant
SELECT T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T1.name = 'Weeks';
human
Also, what is their customer ID? | Weeks's id? | yes, Weeks' ID, please.
assistant
SELECT custid FROM accounts WHERE name = "Weeks" ;