Company: HackerRank_Forward deploy engineer_26june
Difficulty: medium
As part of developing accounting software, create a query that returns a list of the totals of positive and negative transactions for each account. Each transaction record has an amount in accounting number format: if the transaction is negative, the number is unsigned but enclosed in parentheses. The result should have the following columns: iban / debit / credit. iban - account IBAN debit - the total sum of all negative transactions credit - the total sum of all positive transactions The debit and credit amounts should have 2 places after the decimal. Ten should be shown as 10.00. The result should be sorted in ascending order by iban. Schema accounts id INT PRIMARY KEY Account ID iban VARCHAR(255) Account IBAN transactions account_id INT FOREIGN KEY (account_id => accounts.id) Account ID amount VARCHAR(255) Transaction amount