iOS Version Adoption

ASKED IN INTERVIEW
4pts
Apple

Problem Statement

Apple software engineers need to know the adoption rate of various iOS versions to plan the rollout of new features.

Write an SQL query to find each iOS version and the percentage of the total fleet running that version.

Rules:

  • The percentage should be calculated as: (Number of devices on version / Total number of devices) * 100.
  • Round the percentage to 1 decimal place.
  • Output columns: ios_version, adoption_rate.
  • Results must be sorted by adoption_rate in descending order, then ios_version in descending order.
Tests your understanding of
Aggregation, Window Functions and Percentages

Input Tables

OS_Stats
device_id(INTEGER)ios_version(VARCHAR)
117.0
217.0
316.5
417.0
515.0

Expected Output

ios_version(VARCHAR)adoption_rate(DECIMAL)
17.060
16.520
15.020

Tags

MediumASKED IN INTERVIEWAggregationWindow FunctionsPercentages
10-15 min
75%

Hints