PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers

Quick Overview

This question evaluates proficiency in SQL data manipulation—specifically use of window functions, CTEs, deduplication by earliest timestamp, temporal comparisons, and cohort-level aggregation—within the Data Manipulation (SQL/Python) domain for a Data Analyst role in health‑tech product analytics.

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

Compute percent of first-cancelled users who never rebook

Company: Pinterest

Role: Data Analyst

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

You are interviewing for a health-tech product analytics role. Assume the following table contains one row per appointment with its final status. **Table: `appointments`** - `appointment_id` (BIGINT, primary key) - `user_id` (BIGINT, not null) - `scheduled_start_at` (TIMESTAMP, not null) — when the appointment was scheduled to start - `status` (VARCHAR, not null) — one of: `'cancelled'`, `'returned'`, `'confirmed'`, `'completed'`, `'no_show'` - `status_updated_at` (TIMESTAMP, not null) — when the final `status` was set **Definitions / assumptions** - All timestamps are in UTC. - A user can have multiple appointments. - A user’s **first appointment** is the appointment with the earliest `scheduled_start_at` (break ties by smallest `appointment_id`). - A **first-cancelled user** is a user whose first appointment has `status = 'cancelled'`. - A user is considered to **have another future returned/confirmed appointment** if they have any appointment with `scheduled_start_at` strictly after their first appointment’s `scheduled_start_at` and with `status IN ('returned','confirmed')`. **Task** Write a SQL query to compute the **percentage of first-cancelled users who never have another future returned/confirmed appointment**. **Required output (single row)** - `first_cancelled_users` (integer) - `never_returned_confirmed_users` (integer) - `pct_never_returned_confirmed` (decimal between 0 and 1) (You may use CTEs and window functions.)

Quick Answer: This question evaluates proficiency in SQL data manipulation—specifically use of window functions, CTEs, deduplication by earliest timestamp, temporal comparisons, and cohort-level aggregation—within the Data Manipulation (SQL/Python) domain for a Data Analyst role in health‑tech product analytics.

Last updated: May 7, 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
  • Careers
  • 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-cancel users who never return - Pinterest (easy)
  • Find top category by video time spent - Pinterest (Medium)
  • Write SQL to compute max-overlap lists - Pinterest (Medium)