AnalystPath

Highest Unique Queue Ticket

SQLEasyJunior level~15 min

Problem

Table: `queue_tickets`

| Column Name | Type |
|---|---|
| ticket_no | int |

Each row holds one paper ticket number that was pulled from the dispenser at a help desk. The same number can be printed more than once, so the table may contain duplicate values and has no primary key.

A ticket number is called **unique** when it appears on exactly one row. Return the largest unique ticket number under the alias `top_unique`. If no number is unique, return `null`.

Tables

Example rows — the live problem includes the full dataset.

queue_tickets
ticket_no
40
40
15

Expected output

Your answer should return 1 row with the columns top_unique.

Starter code (SQL)

SELECT *
FROM queue_tickets;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions