Back to problems

Identify country with highest sunny-day probability

SQL · Capital One · Medium

Given two tables countries and weather_obs, write a single standard SQL query that returns the country where an observed day has the greatest likelihood of being sunny. For one country and one obs_date: The date is considered sunny when at least one observation row has condition = 'Sunny', ignoring letter case. The date is excluded from all counts only when every observation row for that country-date has NULL as its condition. Otherwise, the date counts as an observed day…

Checking your access…