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
7-Day Rolling Network Traffic
00:00
5 left

7-Day Rolling Network Traffic

HardSQL · PostgreSQL

Problem

Juniper Networks uses daily telemetry from Juniper Mist and Junos devices to monitor network demand. Write a PostgreSQL query that calculates a seven-day rolling average of daily traffic and compares it with the immediately preceding seven-day period.

Requirements

  1. Aggregate traffic by calendar date, treating missing dates and NULL traffic values as zero.
  2. Generate a contiguous daily time series so each rolling window represents seven calendar days.
  3. Calculate the current seven-day average, the previous seven-day average, the absolute change, and the percentage change.
  4. Return only dates with two complete, non-overlapping seven-day periods, ordered chronologically.

Schema

network_traffic_daily
ColumnTypeDescription
traffic_idPKINTUnique telemetry record identifier
traffic_dateDATEDate of the traffic measurement
device_groupVARCHAR(40)Juniper device group or product family
traffic_gbNUMERIC(10,2)Traffic volume in gigabytes
Tablesnetwork_traffic_daily
Interviewer

Your question is 7-Day Rolling Network Traffic. Start with the requirements and the one table 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.