Member-only story
Deloitte Interview Question — Data Engineer III
🧩 Fixing a Reversed Column — A Classic SQL & PySpark Interview Puzzle
3 min read4 days ago
Press enter or click to view image in full size
Imagine this 👇
You’re a Data Engineer. An Excel file was loaded into a SQL database… but something went wrong.
UserID ✅ loaded correctly
FirstName ✅ loaded correctly
LastName ❌ loaded in reverse order
Friend link for non-member readers is here — Link
Your mission (should you choose to accept it 😄):
👉 Fix the LastName column so each user gets their correct last name — without reloading the data.
This is a very popular interview question (Deloitte, Accenture, Big4 vibes 😄), and it tests how well you understand ordering, window functions, and data transformations.
Let’s solve it step by step, first in SQL, then in PySpark, in a way that even beginners can follow.
🧠 Understanding the Problem (Beginner Friendly)
Input Table (Incorrect Data)
Press enter or click to view image in full size