0
← Exercises/
Fundamentals•7 of 12
FundamentalsBeginnerPRO

Surge Pricing Driver Eligibility

Scenario

During peak hours, QuickRide activates a 2.5x surge pricing multiplier. Only active online drivers in premium vehicle classes ('XL' and 'Black') who maintain a rating of 4.85 or higher and have at least 100 completed trips qualify for priority dispatch.

Task
Find all qualifying drivers in `driver_profiles` who: - Are currently online (`is_online = true`) - Have vehicle tier in `'XL'` or `'Black'` - Have a driver `rating` of at least **4.85** - Have completed at least **100** `lifetime_trips` Return: 1. `driver_id` 2. `driver_name` 3. `vehicle_tier` 4. `rating` 5. `lifetime_trips` Order results by `rating` descending, then by `lifetime_trips` descending.
Expected Output Format

Online top-rated XL and Black tier drivers eligible for surge dispatch.

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 “Surge Pricing Driver Eligibility” SQL Problem

Business Scenario

During peak hours, QuickRide activates a 2.5x surge pricing multiplier. Only active online drivers in premium vehicle classes ('XL' and 'Black') who maintain a rating of 4.85 or higher and have at least 100 completed trips qualify for priority dispatch.

Expected Output & Criteria

Online top-rated XL and Black tier drivers eligible for surge dispatch.

Database Table Schema (PostgreSQL DDL)

PostgreSQL 16 WASM

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

CREATE TABLE driver_profiles (
        driver_id INT PRIMARY KEY,
        driver_name VARCHAR(80) NOT NULL,
        vehicle_tier VARCHAR(20) NOT NULL,
        rating NUMERIC(3, 2) NOT NULL,
        lifetime_trips INT NOT NULL,
        is_online BOOLEAN NOT NULL
      );

Target SQL Clauses & Operators

WHEREINORDER BY

Want more Fundamentals practice?

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

View Fundamentals Track→