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
ExperiencesCoaching
New
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
Get started
DNS Backend Flow for a URL
00:00
5 left

DNS Backend Flow for a URL

MediumSQL · PostgreSQL

Problem

What happens in the backend DNS when you hit www.google.com in a browser?

Using the supplied DNS request and event tables, write a SQL query that summarizes each completed request for www.google.com. Include only requests with recorded resolution events.

Output

  1. One row per qualifying request, with request_id, resolver_ip, lookup_started_at, resolution_path, final_answer, and total_latency_ms.
  2. Order by lookup_started_at ascending, then request_id ascending.

Schema

dns_requests
ColumnTypeDescription
request_idPKINTUnique browser DNS request identifier
hostnameVARCHAR(255)Hostname requested by the browser
client_ipINETClient address that initiated the request
resolver_ipINETRecursive resolver address
lookup_started_atTIMESTAMPTZTime at which resolution started
statusVARCHAR(20)Overall request status
dns_events
ColumnTypeDescription
event_idPKINTUnique DNS event identifier
request_idINTRelated browser DNS request
stage_orderINTPosition of the event in the resolution path
server_roleVARCHAR(40)DNS component involved in the event
answerVARCHAR(255)DNS answer returned at this stage
response_codeINTDNS response code
latency_msINTLatency contributed by the event
Tablesdns_requestsdns_events
Interviewer

Your question is DNS Backend Flow for a URL. 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.