Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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 feedbackCoaching1:1 coaching with people at your target companiesSuccess 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 Dashboard Data Integrity
00:00
5 left

Ensuring Dashboard Data Integrity

HardSQL · PostgreSQL

Problem

How do you ensure the accuracy and integrity of data when building automated dashboards?

Write a PostgreSQL query using the supplied tables to produce a validation report for every expected site and production date.

Output

  1. One row per expected site and production date
  2. Columns: site_name, production_date, target_tonnes, reported_tonnes, entry_count, invalid_entry_count, duplicate_entry_count, variance_tonnes, and data_quality_status
  3. Include expected dates with no production entries, order by site and production date, and classify each row as VALID, NO_DATA, INVALID, or DUPLICATE

Schema

mine_sites
ColumnTypeDescription
site_idPKINTUnique mine site identifier
site_nameVARCHAR(100)Mine site name
regionVARCHAR(100)Operating region
daily_targets
ColumnTypeDescription
target_idPKINTUnique target identifier
site_idINTReferenced mine site
production_dateDATEExpected production date
target_tonnesNUMERIC(12,2)Expected production in tonnes
production_entries
ColumnTypeDescription
entry_idPKINTUnique production entry identifier
site_idINTReferenced mine site
production_dateDATEProduction date
shift_codeVARCHAR(20)Shift identifier
production_tonnesNUMERIC(12,2)Reported production in tonnes
recorded_atTIMESTAMPSource recording timestamp
Tablesmine_sitesdaily_targetsproduction_entries
Interviewer

Your question is Ensuring Dashboard Data Integrity. 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.