Your question is SQL Query Output. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Argo Data processes check and payment items for banks. Here is a small slice of its account and transaction tables, already loaded with sample rows.
CREATE TABLE accounts (
account_id INT PRIMARY KEY,
customer_name TEXT,
balance NUMERIC
);
INSERT INTO accounts (account_id, customer_name, balance) VALUES
(1, 'Alice', 500),
(2, 'Bob', 1200),
(3, 'Chris', 0);
CREATE TABLE transactions (
txn_id INT PRIMARY KEY,
account_id INT REFERENCES accounts(account_id),
txn_type TEXT,
amount NUMERIC
);
INSERT INTO transactions (txn_id, account_id, txn_type, amount) VALUES
(101, 1, 'deposit', 150),
(102, 1, 'withdrawal', -50),
(103, 2, 'deposit', 300),
(104, 3, 'deposit', NULL);
Now consider this query:
SELECT
a.customer_name,
COUNT(t.txn_id) AS txn_count,
SUM(t.amount) AS total_amount
FROM accounts a
LEFT JOIN transactions t ON a.account_id = t.account_id
GROUP BY a.customer_name
ORDER BY total_amount DESC NULLS LAST;
Write out exactly what this query returns: every row, every column value, and the order the rows come back in. Pay close attention to what NULL does inside SUM.