You’re analyzing appointment behavior for a scheduling product.
appointmentsappointment_id
(STRING, PK)
user_id
(STRING)
scheduled_start_ts
(TIMESTAMP, UTC) — when the appointment was scheduled to happen
status
(STRING) — one of:
confirmed
,
cancelled
,
returned
scheduled_start_ts
for that user.
scheduled_start_ts
strictly greater than the
scheduled_start_ts
of their first cancelled appointment, and
status IN ('returned', 'confirmed')
.
Write a SQL query to compute the percentage of users whose first cancelled appointment is followed by no future returned or confirmed appointment.
Return exactly one row with:
percent_never_returned
(DECIMAL) — 100 * (number of qualifying users / number of users who have at least one cancelled appointment).