Loading...

Tenure Spread for Active Tokens

A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
hard
Seniority
mid, senior

Problem

Among active API tokens (where expires is null or in the future), find the gap in days between the longest-tenured and shortest-tenured tokens. Also report how many tokens share the earliest issued date and how many share the latest. Return the day spread, count at earliest, and count at latest.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.