SQL Interview Tips 5/100 | Uber Interview #shorts

Shashank Mishra (E‑Learning Bridge)
Shashank Mishra (E‑Learning Bridge)Mar 31, 2026

Why It Matters

Understanding how to classify hierarchical data with SQL is a core skill for data‑engineer interviews, directly impacting a candidate's ability to solve real‑world database problems.

Key Takeaways

  • Identify root nodes by checking for null parent values.
  • Classify leaf nodes as those absent from parent column list.
  • Use CASE WHEN in SQL to assign node_type column.
  • Inner nodes are any non‑root, non‑leaf entries in table.
  • Practice similar problems on Grow Data Skills interview platform.

Summary

The video tackles a classic SQL interview challenge: given a table representing a binary tree, produce a result set that labels each node as Root, Inner or Leaf. The presenter walks through the schema, where each row contains a node identifier and its parent identifier, and explains how to derive a new column indicating the node type.

The solution hinges on three logical checks. First, a node whose parent field is NULL is classified as the Root. Second, leaf nodes are identified by excluding any node that appears in the distinct list of parent values—if a node never serves as a parent, it must be a leaf. Finally, any remaining nodes that are neither root nor leaf are labeled Inner. These conditions are implemented succinctly with a CASE WHEN expression in a SELECT statement.

Key excerpts include, “any such type of node where the parent is null that will be known as our root,” and “leaf nodes are not the parent of any other node, so they are not present in the parent column.” The presenter also demonstrates the use of a NOT IN subquery against the distinct parent set to flag leaves.

Mastering this pattern equips candidates to answer a frequent data‑engineering interview question, showcases proficiency with conditional logic in SQL, and prepares them for more complex hierarchical queries. The speaker directs viewers to the Grow Data Skills platform for additional practice problems and structured interview preparation.

Original Description

🚨 Join my top notch, industrial projects based "Complete Multicloud Data & AI Engineering - From Basic To Advance" Bootcamp to become the best data professional in 2026
📌 Dedicated Placement Assistance & Doubt Support
📞 For Enquiries, Call/WhatsApp: (+91) 9893181542
😎 2 Cr+ Highest Salary Package So Far
⭐ Access FREE Technical Content - https://academy.growdataskills.com/l/cc0c24728b
===============================================
⭐ Explore All Courses Here - https://growdataskills.com/course
===============================================
👉 Join Our Data Engineering BootCAMPS - https://growdataskills.com/data-engineering-track
👉 Explore All Our Project Oriented Data BootCAMPS - https://www.growdataskills.com/course
===============================================
👉 Join Our Programming BootCAMPS - https://www.growdataskills.com/course-complete-python
👉 Join Our Data Engineering BootCAMPS - https://growdataskills.com/data-engineering-track
👉 Join Our AI Engineering BootCAMPS - https://growdataskills.com/ai-engineering-track
👉 Join Our Data Analyst BootCAMPS - https://growdataskills.com/data-analyst-track
👉 Join Our Data Science BootCAMPS - https://growdataskills.com/data-science-track
👉 Join Our Industrial Projects - https://growdataskills.com/project-data-science
===============================================
𝗝𝗼𝗶𝗻 our 𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:🔥
⭐ GrowDataSkills Discord - https://discord.gg/PFzAMUXk9M
⭐ GrowDataSkills X Account - https://x.com/GrowDataSkills
⭐ GrowDataSkills Instagram - https://www.instagram.com/growdataskills/
🔅Shashank's Instagram - https://www.instagram.com/_shashank_219/
===============================================
#sql #skills #interview

Comments

Want to join the conversation?

Loading comments...