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

Find least active countries

Last updated: May 7, 2026

Quick Overview

This question evaluates proficiency in SQL-based data manipulation and analytics, focusing on time-based filtering, distinct aggregation, grouping, thresholded inclusion, and producing ordered, limited result sets across calendar-year comparisons.

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

Find least active countries

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Onsite

You are given an ads activity table. **Table: `ad_activity`** - `ad_id` BIGINT — unique ad identifier - `advertiser_id` BIGINT — advertiser that owns the ad - `country` VARCHAR — advertiser country - `activity_date` DATE — activity date in UTC - `is_active` BOOLEAN — whether the ad was active on that date **Definitions** - `active_ads_last_year` = number of distinct `ad_id` values with at least one record where `is_active = TRUE` during calendar year 2023. - `active_ads_this_year` = number of distinct `ad_id` values with at least one record where `is_active = TRUE` during calendar year 2024. - Only include countries where `active_ads_last_year > 1000`. **Task** Return the 10 countries with the smallest `active_ads_this_year` among the eligible countries. **Required output columns** - `country` - `active_ads_this_year` - `active_ads_last_year` Sort by `active_ads_this_year` ascending, then `country` ascending.

Quick Answer: This question evaluates proficiency in SQL-based data manipulation and analytics, focusing on time-based filtering, distinct aggregation, grouping, thresholded inclusion, and producing ordered, limited result sets across calendar-year comparisons.

Related Interview Questions

  • Compare Survey Satisfaction for New and Established Users - Meta (medium)
  • Calculate Daily Survey Response Rates by Country - 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)
|Home/Data Manipulation (SQL/Python)/Meta

Find least active countries

Meta logo
Meta
Feb 22, 2026, 12:00 AM
mediumData ScientistOnsiteData Manipulation (SQL/Python)
4
0
Practice Read
Loading...

You are given an ads activity table.

Table: ad_activity

  • ad_id BIGINT — unique ad identifier
  • advertiser_id BIGINT — advertiser that owns the ad
  • country VARCHAR — advertiser country
  • activity_date DATE — activity date in UTC
  • is_active BOOLEAN — whether the ad was active on that date

Definitions

  • active_ads_last_year = number of distinct ad_id values with at least one record where is_active = TRUE during calendar year 2023.
  • active_ads_this_year = number of distinct ad_id values with at least one record where is_active = TRUE during calendar year 2024.
  • Only include countries where active_ads_last_year > 1000 .

Task Return the 10 countries with the smallest active_ads_this_year among the eligible countries.

Required output columns

  • country
  • active_ads_this_year
  • active_ads_last_year

Sort by active_ads_this_year ascending, then 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

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.