PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates proficiency in data aggregation, grouping, and filtering to summarize categorical time-series records using SQL or equivalent Python data-manipulation tools, and it belongs to the Data Manipulation domain with an emphasis on practical application of query and aggregation techniques.

  • Medium
  • Capital One
  • Data Manipulation (SQL/Python)
  • Data Scientist

Determine Country with Most 'Sunny' Days

Company: Capital One

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Weather +------------+------------+---------+ | country | date | weather | +------------+------------+---------+ | Spain | 2023-07-01 | sunny | | Spain | 2023-07-02 | cloudy | | Brazil | 2023-07-01 | sunny | | Canada | 2023-07-01 | rainy | | Brazil | 2023-07-02 | sunny | +------------+------------+---------+ ##### Scenario A travel company keeps daily weather logs for multiple countries and wants to recommend the destination with the highest likelihood of sunny weather. ##### Question Write an SQL query that returns the country with the greatest number of days classified as 'sunny'. Break ties arbitrarily or return all tied countries. ##### Hints Aggregate with SUM(CASE WHEN weather = 'sunny' THEN 1 END) and sort.

Quick Answer: This question evaluates proficiency in data aggregation, grouping, and filtering to summarize categorical time-series records using SQL or equivalent Python data-manipulation tools, and it belongs to the Data Manipulation domain with an emphasis on practical application of query and aggregation techniques.

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

  • Clean and Merge Housing Data - Capital One (easy)
  • Find Lowest Prices for Highly Rated Categories - Capital One (medium)
  • Write SQL to compute campaign net revenue - Capital One (Medium)
  • Merge CSVs and build revenue pivot with pandas - Capital One (Medium)
  • Find top category per region in Aug 2025 - Capital One (Medium)