Query of the week

Fix a query. A new challenge every Monday.

The no-show list is empty. Find valid, unscanned NOVA tickets. Return ticket in ascending order.

Explore the data
tickets
ticketconcertstatuteuros
A17NOVAOK20
C08NOVAVOID20
B04NOVAOK20
F10NOVAOK25
D12NOVAOK35
E15NOVAOK15
G21NOVAOK30
H31NOVAOK18
J03NOVAOK22
K07NOVAOK24
M88NOVAOK40
L01LUNAOK15
scans
ticketporteminute
A17N0
A17S2
B04N6
D12S13
E15N14
F10S16
G21S17
H31S19
J03S20
K07N29
J03N32
SQL…
Solution and explanation
SELECT t.ticket FROM tickets t LEFT JOIN scans s ON t.ticket=s.ticket
WHERE t.concert='NOVA' AND t.statut='OK' AND s.ticket IS NULL ORDER BY t.ticket;

M88 has a valid reservation and no scan. LEFT JOIN keeps it.

Permanent link to this editionStart the investigation