- or download this
CREATE TABLE txn (txn_id INT PRIMARY KEY AUTO_INCREMENT, account VARCH
+AR(64), amount INT);
ALTER TABLE txn ADD INDEX i1 (account);
- or download this
INSERT INTO txn VALUES (NULL, '101', 40167);
INSERT INTO txn VALUES (NULL, '101', 30821);
...
- or download this
INSERT INTO txn VALUES (NULL, '101', -131386);
- or download this
SELECT account, SUM(amount) as total FROM txn GROUP BY account HAVING
+total <> 0;