About the “Patient ICU Heart Rate Spike Detection with LAG()” SQL Problem
Business Scenario
ICU monitoring systems continuously evaluate bedside telemetry. Sudden increases of 20+ beats per minute (BPM) between consecutive readings trigger cardiac telemetry alarms.
Expected Output & Criteria
Patient telemetry readings showing previous heart rate and BPM delta.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE icu_telemetry (
reading_id INT PRIMARY KEY,
patient_id INT NOT NULL,
reading_time TIMESTAMP NOT NULL,
heart_rate INT NOT NULL
);Target SQL Clauses & Operators
LAGOVERPARTITION BY
Want more Window Functions practice?
Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.