Loading...

Longest Gap Between Token Events

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

Domain
SQL
Difficulty
medium
Seniority
senior

Problem

The security team is reviewing API key rotation policy. Calculate the longest period in days between consecutive token issuances and the longest period between consecutive token expirations in api_tokens. Ignore null expiration dates. Return both maximum gap values.

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.