PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates a candidate's competency in data manipulation and temporal analysis using SQL/Python, focusing on computing user-level metrics and correctly ordering time-based events.

  • easy
  • Pinterest
  • Data Manipulation (SQL/Python)
  • Data Analyst

Compute percent of first-cancel users who never return

Company: Pinterest

Role: Data Analyst

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Technical Screen

You’re analyzing appointment behavior for a scheduling product. ## Table ### `appointments` - `appointment_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` - Assume each appointment appears once with its final status. ## Definitions - A user’s **first cancelled appointment** is the cancelled appointment with the earliest `scheduled_start_ts` for that user. - A **future returned/confirmed appointment** means any appointment for the same user with: - `scheduled_start_ts` strictly greater than the `scheduled_start_ts` of their first cancelled appointment, and - `status IN ('returned', 'confirmed')`. ## Task Write a SQL query to compute the **percentage of users whose first cancelled appointment is followed by _no_ future returned or confirmed appointment**. ### Output Return exactly one row with: - `percent_never_returned` (DECIMAL) — 100 * (number of qualifying users / number of users who have at least one cancelled appointment). ## Notes / Edge cases - Users with no cancelled appointments are excluded from the denominator. - If a user has a returned/confirmed appointment at the exact same timestamp as the first cancellation, do **not** count it as “future”.

Quick Answer: This question evaluates a candidate's competency in data manipulation and temporal analysis using SQL/Python, focusing on computing user-level metrics and correctly ordering time-based events.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Write Queries for Pinterest Engagement Tasks - Pinterest (medium)
  • Write SQL for top categories and highly active users - Pinterest (easy)
  • Compute percent of first-cancelled users who never rebook - Pinterest (medium)
  • Find top category by video time spent - Pinterest (Medium)
  • Write SQL to compute max-overlap lists - Pinterest (Medium)