PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates SQL data manipulation skills and data-quality reasoning, specifically assessing understanding of referential integrity and the detection of orphaned foreign-key references between related tables.

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Business Intelligence Engineer

Identify Employees with Invalid Department References

Company: Amazon

Role: Business Intelligence Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

EMPLOYEE +-----+-----+--------+ | eid | did | ename | +-----+-----+--------+ | 1 | 10 | Alice | | 2 | 11 | Bob | | 3 | 99 | Carol | +-----+-----+--------+ ​ DEPARTMENT +-----+---------+ | did | dname | +-----+---------+ | 10 | Sales | | 11 | Finance | +-----+---------+ ##### Scenario A company database holds EMPLOYEE and DEPARTMENT tables. Management needs to find employees referencing non-existent departments so the data can be cleaned. ##### Question Using SQL, return all rows from EMPLOYEE whose did is not present in DEPARTMENT. ##### Hints Think anti-join patterns such as LEFT JOIN … WHERE department.did IS NULL, or use NOT EXISTS/NOT IN.

Quick Answer: This question evaluates SQL data manipulation skills and data-quality reasoning, specifically assessing understanding of referential integrity and the detection of orphaned foreign-key references between related tables.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find recommended friend pairs by shared songs - Amazon (medium)
  • Find recommended friend pairs by shared listening - Amazon (easy)
  • Write SQL window functions for D7 retention - Amazon (medium)
  • Find daily first-order merchants with SQL - Amazon (Medium)
  • Design student–course data models and SQL - Amazon (Medium)