Help for this page

Select Code to Download


  1. 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);
    
  2. or download this
    INSERT INTO txn VALUES (NULL, '101', 40167);
    INSERT INTO txn VALUES (NULL, '101', 30821);
    ...
    
  3. or download this
    INSERT INTO txn VALUES (NULL, '101', -131386);
    
  4. or download this
    SELECT account, SUM(amount) as total FROM txn GROUP BY account HAVING 
    +total <>  0;