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

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs