Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Window Functions for Recurring Failures

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Window Functions for Recurring Failures. Start with the requirements and the two tables on the right.

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.

Problem

Jio operations teams need to identify recurring failures across JioFiber, JioAirFiber, and other Jio service surfaces. Write a PostgreSQL query using a CTE and a window function to find failure patterns that occurred at least twice during January 2026.

Requirements

  1. Join operational logs to the Jio service catalog.
  2. Consider only rows with status = 'FAILED' and timestamps from 2026-01-01 through 2026-01-31.
  3. Use ROW_NUMBER() to sequence failures within each product, surface, failure code, and region.
  4. Return only recurring patterns, including the failure count, first occurrence, and latest occurrence. Sort by failure count descending, then product and failure code.

Schema

jio_operational_logs
ColumnTypeDescription
log_idPKINTUnique operational log identifier
service_idINTReferences the Jio service catalog
surfaceVARCHAR(80)Operational surface where the event occurred
failure_codeVARCHAR(50)Failure classification code
occurred_atTIMESTAMPTimestamp when the event occurred
statusVARCHAR(20)Operational event status
regionVARCHAR(50)Geographic operating region
jio_service_catalog
ColumnTypeDescription
service_idPKINTUnique Jio service identifier
product_nameVARCHAR(80)Jio product or platform name
owner_teamVARCHAR(80)Team responsible for the service
Tablesjio_operational_logsjio_service_catalog
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results