PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/LinkedIn

Find top countries by population per continent

Last updated: Mar 29, 2026

Quick Overview

This question evaluates data manipulation competency in SQL/Python, specifically testing aggregation, ranking, deterministic tie-breaking, and percentage calculations across grouped data to identify top countries by population per continent.

  • easy
  • LinkedIn
  • Data Manipulation (SQL/Python)
  • Data Scientist

Find top countries by population per continent

Company: LinkedIn

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Technical Screen

### Table `world_population` - `continent` VARCHAR - `country` VARCHAR - `population` BIGINT Assume each row is a country’s latest population and `(continent, country)` is unique. ### Tasks 1. Return the **most populous country in each continent**. - Output columns: `continent`, `country`, `population`. 2. Follow-up: Return the **top 2 most populous countries in each continent**. - Output columns: `continent`, `country`, `population`, plus a `rank_in_continent` (1 = largest). 3. Follow-up: For each continent’s **top 2** countries, compute what **percentage of the continent’s total population** each country represents. - Output columns: `continent`, `country`, `population`, `continent_population`, `population_share_pct`. - `population_share_pct = 100 * population / continent_population` (round to 2 decimals). ### Notes - If there are ties in population, break ties by `country` ascending to make results deterministic.

Quick Answer: This question evaluates data manipulation competency in SQL/Python, specifically testing aggregation, ranking, deterministic tie-breaking, and percentage calculations across grouped data to identify top countries by population per continent.

Related Interview Questions

  • Write SQL for rankings, state, and aggregations - LinkedIn (easy)
  • Analyze member video posting behavior by country - LinkedIn (easy)
  • Compute article-type diversity per user and histogram - LinkedIn (easy)
  • Compute each member’s current notification status - LinkedIn (easy)
  • Count Article Types Viewed - LinkedIn (medium)
LinkedIn logo
LinkedIn
Feb 1, 2026, 5:10 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
2
0

Table

world_population

  • continent VARCHAR
  • country VARCHAR
  • population BIGINT

Assume each row is a country’s latest population and (continent, country) is unique.

Tasks

  1. Return the most populous country in each continent .
    • Output columns: continent , country , population .
  2. Follow-up: Return the top 2 most populous countries in each continent .
    • Output columns: continent , country , population , plus a rank_in_continent (1 = largest).
  3. Follow-up: For each continent’s top 2 countries, compute what percentage of the continent’s total population each country represents.
    • Output columns: continent , country , population , continent_population , population_share_pct .
    • population_share_pct = 100 * population / continent_population (round to 2 decimals).

Notes

  • If there are ties in population, break ties by country ascending to make results deterministic.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More LinkedIn•More Data Scientist•LinkedIn Data Scientist•LinkedIn Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
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.