Find Origin and Final Destination for Each Customer in SQL | SQL Interview Question
Crack DE with Mradul
0:00 / 0:00
Find Origin and Final Destination for Each Customer in SQL | SQL Interview Question
610 просмотров · 1 год назад
Crack DE with Mradul
524 подписчика
610 просмотров · 1 год назад
🛫 SQL Challenge!
Can you find where each customer’s journey begins and ends?
In today’s video, we’ll write a SQL query to find:
✅ The origin city (starting point)
✅ The final destination (end of the trip)
We’ll use a simple Flights table and apply smart logic using subqueries to crack it.
Perfect for SQL interviews and real-world analytics tasks!
🎓 Whether you're preparing for a data job or leveling up your SQL skills — this one's for you.
Great for practicing intermediate SQL transformation skills!
-- 1. Create table
CREATE TABLE flight_tbl (
cust_id INT,
flight_id VARCHAR(10),
origin VARCHAR(50),
destination VARCHAR(50));
-- 2. Insert values
INSERT INTO flight_tbl (cust_id, flight_id, origin, destination)
VALUES
(1, 'AI101', 'Chennai', 'Mumbai'),
(1, 'AI202', 'Nagpur', 'Jaipur'),
(1, 'AI303', 'Mumbai', 'Nagpur'),
(2, 'AI404', 'Bhopal', 'Indore'),
(2, 'AI505', 'Indore', 'Delhi');
Don’t forget to LIKE, SHARE, and SUBSCRIBE for more such SQL tutorials!
#CrackDEwithMradul #SQL #ExchangeSeatsProblerm #DataAnalytics #SQLInterviewQuestion #DataEngineering