PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Meta

Calculate Daily Survey Response Rates by Country

Last updated: Jul 9, 2026

Quick Overview

Work through a PostgreSQL survey-analysis task that compares impressions and responses by date and country. It exercises careful joins, distinct-user counting, orphan-event handling, numeric rate calculation, output grain, and deterministic ordering.

  • medium
  • Meta
  • Data Manipulation (SQL/Python)
  • Data Scientist

Calculate Daily Survey Response Rates by Country

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

The interview report preserved the survey tables and the request to calculate response rate, but not the exact grouping or output contract. The following is a self-contained practice reconstruction of that task. You have two PostgreSQL tables: ```text survey ------ user_id BIGINT NOT NULL event_date DATE NOT NULL survey_event TEXT NOT NULL -- 'impression' or 'response' response INTEGER NULL -- 1 through 5 for a response; NULL for an impression users ----- user_id BIGINT PRIMARY KEY reg_date DATE NOT NULL country TEXT NOT NULL ``` Within a calendar date, a user has at most one `impression` row and at most one `response` row. Every `survey.user_id` has a matching `users` row. A response counts only when the same user also has an impression on the same date; ignore orphan response rows. All `response` rows contain an integer from 1 through 5. Write one PostgreSQL query that returns one row for each `event_date` and `country` with at least one survey impression. Return: - `survey_date` - `country` - `impressed_users`: number of distinct users with an impression that day - `responding_users`: number of those impressed users who also responded that day - `response_rate`: `responding_users / impressed_users` as a decimal between 0 and 1 Preserve numeric precision rather than formatting the rate as text or a percentage. Order the result by `survey_date` ascending and `country` ascending.

Quick Answer: Work through a PostgreSQL survey-analysis task that compares impressions and responses by date and country. It exercises careful joins, distinct-user counting, orphan-event handling, numeric rate calculation, output grain, and deterministic ordering.

Related Interview Questions

  • Compare Survey Satisfaction for New and Established Users - Meta (medium)
  • Find A Low-Quality Annotator From Label Data - Meta (hard)
  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)
  • Count heavy callers in 7 days - Meta (medium)
|Home/Data Manipulation (SQL/Python)/Meta

Calculate Daily Survey Response Rates by Country

Meta logo
Meta
Jul 6, 2026, 12:00 AM
mediumData ScientistTechnical ScreenData Manipulation (SQL/Python)
0
0

The interview report preserved the survey tables and the request to calculate response rate, but not the exact grouping or output contract. The following is a self-contained practice reconstruction of that task.

You have two PostgreSQL tables:

survey
------
user_id       BIGINT   NOT NULL
event_date    DATE     NOT NULL
survey_event  TEXT     NOT NULL  -- 'impression' or 'response'
response      INTEGER  NULL      -- 1 through 5 for a response; NULL for an impression

users
-----
user_id       BIGINT   PRIMARY KEY
reg_date      DATE     NOT NULL
country       TEXT     NOT NULL

Within a calendar date, a user has at most one impression row and at most one response row. Every survey.user_id has a matching users row. A response counts only when the same user also has an impression on the same date; ignore orphan response rows. All response rows contain an integer from 1 through 5.

Write one PostgreSQL query that returns one row for each event_date and country with at least one survey impression. Return:

  • survey_date
  • country
  • impressed_users : number of distinct users with an impression that day
  • responding_users : number of those impressed users who also responded that day
  • response_rate : responding_users / impressed_users as a decimal between 0 and 1

Preserve numeric precision rather than formatting the rate as text or a percentage. Order the result by survey_date ascending and country ascending.

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Meta•More Data Scientist•Meta Data Scientist•Meta Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,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
  • AI Coding 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.