I have the following tables with data below
Table 1: events:
Logging table that capture particular events as they come in the conversation
date
user_id (can be sender or receiver depending on the event and the case)
event_time
event (3 possible values 'suggested_4_options','clicked_gif_suggestion','received_gif')
suggested_gif_ids (assume array of 4 suggestions if it is about suggested gifs)
gif_id (assume single id of gif sent/received when it is the case)
Table 2: dim_all_users
date
user_id
gender
age
country
Definition: CTR click through rate as defined by the number of clicks divided by the number of suggestions
Question 1:
What are the top 5 gifs sent as a result of suggestions?
Question 2:
Write 1 query to compare the CTR of the age group 15-25 and 45-55.
The output of the query should be the following:
'15-25', 0.7
'45-55', 0.4