Загрузка...

Crazy SQL Interview Problem for Senior Data Engineers | Cyclic Money Transactions

In this video, we solve a challenging SQL interview problem often asked for Senior Data Engineer and Analytics Engineer roles.

### Problem Statement

Given a transactions table, identify all groups of users involved in a circular money flow where:

✔ Money starts from User A
✔ Passes through one or more intermediate users
✔ Returns back to User A
✔ All transactions occur within 1 hour
✔ Amount remains constant throughout the cycle
✔ No user repeats in the path except the starting user

### Concepts Covered

• Recursive CTE
• Graph Traversal using SQL
• Cycle Detection
• Path Building
• Advanced SQL Interview Questions
• Real World Fraud Detection Scenarios
• SQL Server Solution

This is a great problem to strengthen your recursive CTE skills and understand how SQL can be used to detect suspicious transaction patterns.

If you want more such advanced SQL interview problems, subscribe to the channel and keep practicing. 🚀

script:
create table transactions (
transaction_id int primary key,
sender_id varchar(3) not null,
receiver_id varchar(3) not null,
amount int not null,
transaction_time datetime not null
);

insert into transactions values
(1, 101, 102, 500, '2025-01-01 09:00:00'),
(2, 102, 103, 500, '2025-01-01 09:10:00'),
(3, 103, 101, 500, '2025-01-01 09:20:00'),
(4, 201, 202, 1000, '2025-01-01 10:00:00'),
(5, 202, 203, 1000, '2025-01-01 10:05:00'),
(6, 203, 204, 1000, '2025-01-01 10:10:00'),

(7, 301, 302, 1000, '2025-01-01 10:00:00'),
(8, 302, 301, 1000, '2025-01-01 10:05:00'),

(9, 401, 402, 500, '2025-01-01 09:00:00'),
(10, 402, 403, 500, '2025-01-01 09:10:00'),
(11, 403, 404, 500, '2025-01-01 09:20:00'),
(12, 404, 401, 500, '2025-01-01 09:25:00');

Zero to hero(Advance) SQL Aggregation:
https://youtu.be/5Ighj_2PGV0

Most Asked Join Based Interview Question:
https://youtu.be/xR87ctOgpAE

Solving 4 Trick SQL problems:
https://youtu.be/Ck1gQrlS5pQ

Data Analyst Spotify Case Study:
https://youtu.be/-YdAIMjHZrM

Top 10 SQL interview Questions:
https://youtu.be/Iv9qBz-cyVA

Interview Question based on FULL OUTER JOIN:
https://youtu.be/KQfWd6V3IB8

Playlist to master SQL :
https://youtube.com/playlist?list=PLBTZqjSKn0IeKBQDjLmzisazhqQy4iGkb

Rank, Dense_Rank and Row_Number:
https://youtu.be/xMWEVFC4FOk

#sql #dataengineer

Видео Crazy SQL Interview Problem for Senior Data Engineers | Cyclic Money Transactions канала Ankit Bansal
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять