Bank Data Analyst SQL Interview Questions
1. Retrieve all customers from Karachi branch.
SELECT * FROM Customers
WHERE City = 'Karachi';
2. Find all transactions between July 1 and July 31.
SELECT * FROM Transactions
WHERE TransactionDate BETWEEN '2025-07-01' AND '2025-07-31';
3. Get total balance per branch.
SELECT BranchID, SUM(AccountBalance) AS TotalBalance
FROM Accounts
GROUP BY BranchID;
4. Show account holder name with their account balance.
SELECT c.CustomerName, a.AccountBalance
FROM Customers c
JOIN Accounts a ON c.CustomerID = a.CustomerID;
5. Get customers who have account balance above the average.
SELECT CustomerID, AccountBalance
FROM Accounts
WHERE AccountBalance > (
SELECT AVG(AccountBalance) FROM Accounts
);
6. Label customers as 'High Value' if balance > 1,00,000.
SELECT CustomerName,
CASE
WHEN AccountBalance > 100000 THEN 'High Value'
ELSE 'Regular'
END AS CustomerType
FROM Accounts;
7. Get top 3 highest transactions per customer.
SELECT *
FROM (
SELECT *, ROW_NUMBER() OVER(PARTITION BY CustomerID ORDER BY Amount DESC) AS rn
Bank Data Analyst SQL Interview Questions
FROM Transactions
) t
WHERE rn <= 3;
8. Count number of accounts opened in each month.
SELECT MONTH(AccountOpenDate) AS Month, COUNT(*) AS TotalAccounts
FROM Accounts
GROUP BY MONTH(AccountOpenDate);
9. Find inactive customers with no transactions in the last 6 months.
SELECT * FROM Customers c
LEFT JOIN Transactions t ON c.CustomerID = t.CustomerID
WHERE t.TransactionDate IS NULL
OR t.TransactionDate < DATEADD(MONTH, -6, GETDATE());
10. List branches with more than 1000 customers.
SELECT BranchID, COUNT(*) AS CustomerCount
FROM Customers
GROUP BY BranchID
HAVING COUNT(*) > 1000;
11. Calculate the average transaction amount per customer.
SELECT CustomerID, AVG(Amount) AS AvgAmount
FROM Transactions
GROUP BY CustomerID;
12. List customers who made more than 5 transactions in a single day.
SELECT CustomerID, TransactionDate, COUNT(*) AS TotalTransactions
FROM Transactions
GROUP BY CustomerID, TransactionDate
HAVING COUNT(*) > 5;
13. Get the latest transaction per customer.
SELECT CustomerID, MAX(TransactionDate) AS LastTransaction
FROM Transactions
GROUP BY CustomerID;
Bank Data Analyst SQL Interview Questions
14. Find duplicate accounts (same customer name and DOB).
SELECT CustomerName, DateOfBirth, COUNT(*)
FROM Customers
GROUP BY CustomerName, DateOfBirth
HAVING COUNT(*) > 1;
15. List customers with no accounts.
SELECT * FROM Customers c
LEFT JOIN Accounts a ON c.CustomerID = a.CustomerID
WHERE a.AccountID IS NULL;