Interview Query

Popular Apple Actions

12
Have you seen this question before?

Write a query to determine the top 5 actions performed during the month of November 2020, for actions performed on an Apple platform (iPhone, iPad).

The events table tracks every time a user performs a certain action (like post_enter, etc.) on a platform (android, web, etc.).

The output should include the action performed and it’s rank in ascending order. If two actions are performed equally, they should have the same rank. 

Example:

Input:

events table

Column Type
user_id INTEGER
created_at DATETIME
action VARCHAR
platform VARCHAR

Output:

Column Type
action VARCHAR
ranks INTEGER
Next question: Duplicate Product Names
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query