0
← Exercises/
Business Analytics•13 of 14
Business AnalyticsAdvancedPRO

Real-Time Supply-Demand Imbalance Surge Multiplier

Scenario

Ride hailing pricing algorithms compute real-time surge multipliers per geographic zone based on the ratio of active rider demand requests to available nearby drivers.

Task
For each geographic zone in `zone_supply_demand`, compute `demand_supply_ratio` (`rider_requests::numeric / available_drivers`) and assign a surge multiplier: - If `demand_supply_ratio >= 3.0` THEN `2.5` - Else if `demand_supply_ratio >= 2.0` THEN `1.8` - Else if `demand_supply_ratio >= 1.5` THEN `1.3` - Else `1.0` Return: 1. `zone_id` 2. `zone_name` 3. `rider_requests` 4. `available_drivers` 5. `demand_supply_ratio`: `ROUND(rider_requests::numeric / available_drivers, 2)` 6. `surge_multiplier` Order results by `surge_multiplier` descending, then by `zone_id` ascending.
Expected Output Format

Geographic dispatch zones with calculated surge pricing multipliers.

Input Tables & Sample Data0 tables
Loading database schema...
Need a hint?
query.sql|Local Sandbox
Loading SQL editor...
Click "Run" or press ⌘ + Enter to execute your query

About the “Real-Time Supply-Demand Imbalance Surge Multiplier” SQL Problem

Business Scenario

Ride hailing pricing algorithms compute real-time surge multipliers per geographic zone based on the ratio of active rider demand requests to available nearby drivers.

Expected Output & Criteria

Geographic dispatch zones with calculated surge pricing multipliers.

Database Table Schema (PostgreSQL DDL)

PostgreSQL 16 WASM

This challenge executes directly against the following relational schema in your browser:

CREATE TABLE zone_supply_demand (
        zone_id INT PRIMARY KEY,
        zone_name VARCHAR(50) NOT NULL,
        rider_requests INT NOT NULL,
        available_drivers INT NOT NULL
      );

Target SQL Clauses & Operators

CASEWHENORDER BY

Want more Business Analytics practice?

Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.

View Business Analytics Track→