How to find accounts that never had positive balance | SQL Interview questions
DML Script:
DROP TABLE IF EXISTS AccountBalances;
GO
CREATE TABLE AccountBalances
(
AccountID INTEGER,
Balance MONEY,
PRIMARY KEY (AccountID, Balance)
);
GO
INSERT INTO AccountBalances (AccountID, Balance)
VALUES
(1001,-234.45),
(1001,23.12),
(2002,-93.01),
(2002,-120.19),
(3003,186.76),
(3003,-90.23),
(3003,-10.11);
GO
SELECT * FROM AccountBalances
Detailed Explanation: https://youtu.be/7niFpj-lXP0
Comments
Post a Comment