Loading...

Peak Concurrent Tokens

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

Domain
SQL
Difficulty
hard
Seniority
senior, staff

Problem

For every API token that has ever been issued, find the greatest number of concurrently active tokens during its lifetime and the first date that peak was reached. A token is active from its issued date until the day before its expiration; tokens with no expiration are considered still active. Return the token ID, peak concurrent count, and peak date.

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.