SQL Challenges · WEEKLY QUACK CHALLENGE!

NIGHT AT THE DUCKSEUM

Difficulty: hard

Curator Canvasback fans through the overnight badge log, beak trembling. Five guards walked these halls last night, Duckbert — but one of them showed up at two doors so far apart that no duck could have waddled between them in time. Someones badge got cloned. Or worse. Find the guard whose consecutive swipes defy the laws of physics — and duck anatomy.

Your task

Catch the imposter. For each guard, scan their badge swipes in time order: a consecutive pair is impossible when less time passed between the two swipes than the minutes needed to walk between those doors (`door_distances` gives the walk for both directions). Return the name of the one guard with an impossible pair. You will be working with the `badge_swipes` and `door_distances` tables.

Tables

badge_swipes (19 rows)

columntype
guard_idINTEGER
guard_nameVARCHAR
door_idINTEGER
tsTIMESTAMP

door_distances (30 rows)

columntype
door_aINTEGER
door_bINTEGER
walk_minutesINTEGER

Database: https://dbquacks.com/data/databases/weekly_202634_08_duckseum.duckdb

This page as markdown: https://dbquacks.com/challenges/weekly/8.md

Play this challenge →