Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Ensuring Data Integrity in High Stakes
00:00
5 left

Ensuring Data Integrity in High Stakes

HardSQL · PostgreSQL

Problem

What is your approach to ensuring data integrity in high-stakes environments like compensation or workplace tech?

Write a PostgreSQL query that audits compensation changes against employee and approval records. Identify every integrity finding in the supplied data, including missing employee references, invalid salary amounts, duplicate effective dates, missing or improperly timed submission dates, salary decreases, and changes without an approved approval.

Output

  1. One row per detected finding, with employee_id, employee_name, change_id, effective_date, salary_amount, approval_status, and issue_code.
  2. Include only records with a finding. Rows with NULL employee names may appear when the employee reference is missing.
  3. Sort by employee ID, change ID, and a logical issue priority.

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(80)Employee display name
employment_statusVARCHAR(30)Current employment status
compensation_changes
ColumnTypeDescription
change_idPKINTUnique compensation change identifier
employee_idINTEmployee affected by the change
effective_dateDATEDate when the compensation change takes effect
salary_amountNUMERIC(12,2)Annual salary amount after the change
submitted_atTIMESTAMPTimestamp when the change was submitted
compensation_approvals
ColumnTypeDescription
approval_idPKINTUnique approval event identifier
change_idINTCompensation change under review
approval_statusVARCHAR(40)Approval decision
approved_atTIMESTAMPTimestamp of the approval event
Tablesemployeescompensation_changescompensation_approvals
Interviewer

Your question is Ensuring Data Integrity in High Stakes. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.