Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare Error Volume Before and After Release

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

Your question is Compare Error Volume Before and After Release. 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

You are given release records and application error logs. Write a PostgreSQL query that compares error volume in the 7 days before each release to the 7 days after it, and returns the release version, release date, pre-release error count, post-release error count, and the percentage change in error volume.

Use the release date as the boundary: the pre-release window is the 7 full days before the release date, and the post-release window is the 7 full days starting on the release date. Exclude releases that do not have any error logs in either window.

Schema

releases
ColumnTypeDescription
release_idPKINTPrimary key for the release record
release_versionVARCHAR(50)Human-readable release version
release_dateDATEDate the software release went live
error_logs
ColumnTypeDescription
error_idPKINTPrimary key for the error event
release_idINTForeign key to releases.release_id
error_timestampTIMESTAMPWhen the error occurred
error_severityVARCHAR(20)Severity label for the error
service_nameVARCHAR(50)Service where the error occurred
Tablesreleaseserror_logs
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results