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
HTTP and JSON Data Processing
00:00
5 left

HTTP and JSON Data Processing

MediumSQL · PostgreSQL

Problem

Describe how you parse HTTP responses and process JSON data in your software.

For this SQL exercise, response payloads are stored as PostgreSQL JSONB. Write a query that returns parsed entities from successful responses and handles missing JSON fields consistently.

Output

  1. One row per entity in a successful response, with request_id, endpoint, received_at, item_position, entity_id, entity_name, entity_type, and normalized_status.
  2. Include only HTTP status codes from 200 through 299, normalize missing or unrecognized statuses to unknown, and order by received_at, request_id, and item_position.

Schema

api_requests
ColumnTypeDescription
request_idPKINTUnique identifier for the outgoing HTTP request
endpointVARCHAR(120)Requested API endpoint
requested_atTIMESTAMPTime when the request was sent
client_nameVARCHAR(80)Optional name of the calling client
http_responses
ColumnTypeDescription
response_idPKINTUnique identifier for the HTTP response
request_idINTIdentifier of the related request
status_codeINTHTTP response status code
received_atTIMESTAMPTime when the response was received
response_bodyJSONBDecoded HTTP response body
Tablesapi_requestshttp_responses
Interviewer

Your question is HTTP and JSON Data Processing. 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.