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
Terraform And SQL Fundamentals
00:00
5 left

Terraform And SQL Fundamentals

HardSQL · PostgreSQL

Problem

Explain how you use Terraform to manage infrastructure and how you think about core SQL concepts like INNER JOIN, self join, unique keys, and traces/observability.

Using the supplied Terraform resource and observability trace tables, write a query that audits production resources managed by Terraform. Include only resources with qualifying traces, while preserving parent-resource information when available.

Output

  1. One row per qualifying resource with resource_key, resource_name, parent_resource_name, trace_count, failed_trace_count, and avg_duration_ms
  2. Include traces observed on or after 2026-01-01
  3. Order by resource_key ascending

Schema

terraform_resources
ColumnTypeDescription
resource_idPKINTInternal resource identifier
resource_keyVARCHAR(120)Stable unique Terraform resource key
resource_nameVARCHAR(120)Human-readable resource name
resource_typeVARCHAR(80)Terraform provider resource type
environmentVARCHAR(30)Deployment environment
managed_byVARCHAR(30)Infrastructure management system
parent_resource_idINTOptional self-referencing parent resource
observability_traces
ColumnTypeDescription
trace_idPKINTTrace record identifier
resource_idINTResource associated with the trace
statusVARCHAR(20)Trace outcome
duration_msDECIMAL(10,2)Trace duration in milliseconds
observed_atDATETrace observation date
Tablesterraform_resourcesobservability_traces
Interviewer

Your question is Terraform And SQL Fundamentals. Start with the requirements and the two 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.