Instagram User Analytics
Instagram User Analytics
MARKETING
a) Rewarding Most Loyal Users: People who have been using the platform for the
longest time.
Your Task: Find the 5 oldest users of the Instagram from the database provided
QUERY -
WHERE id NOT IN
OUTPUT -
7 Kasandra_Homenick
14 Jaclyn81
21 Rocio33
24 Maxwell.Halvorson
25 Tierra.Trantow
34 Pearl7
36 Ollie_Ledner37
41 Mckenna17
45 David.Osinski47
49 Morgan.Kassulke
53 Linnea59
54 Duane60
57 Julien_Schmidt
66 Mike.Auer39
68 Franco_Keebler64
71 Nia_Haag
74 Hulda.Macejkovic
75 Leslie67
76 Janelle.Nikolaus81
80 Darby_Herzog
81 Esther.Zulauf61
83 Bartholome.Bernhard
89 Jessyca_West
90 Esmeralda.Mraz57
91 Bethany20
c) Declaring Contest Winner: The team started a contest and the user who gets
the most likes on a single photo will win the contest now they wish to declare
the winner.
Your Task: Identify the winner of the contest and provide their details to the
team
QUERY -
FROM photos a
JOIN users b
ON a.user_id = b.id
WHERE a.id IN
(SELECT photo_id
FROM likes
GROUP BY photo_id
LIMIT 1;
QUERY -
FROM photo_tags a
JOIN tags b
ON a.tag_id = b.id
GROUP BY a.tag_id
ORDER BY num_tags_used DESC
LIMIT 5;
e) Launch AD Campaign: The team wants to know which day would be the best
day to launch ADs.
Your Task: What day of the week do most users register on? Provide insights on
when to schedule an ad campaign
QUERY -
SELECT COUNT(*) registrations, DAYNAME(created_at) weekday
FROM users
GROUP BY weekday
ORDER BY registrations DESC;
2. Investor Metrics
a) User Engagement: Are users still as active and post on Instagram or they are
making fewer posts
Your Task: Provide how many times an average user posts on Instagram. Also,
provide the total number of photos on Instagram/total number of users
QUERY -
SELECT
COUNT(*) AS photos_posted,
FROM
photos;
OUTPUT - total users-100, users who posted-74, total photos-257, avg number of
posts by active users - 3.4730
b) Bots & Fake Accounts: The investors want to know if the platform is crowded
with fake and dummy accounts
Your Task: Provide data on users (bots) who have liked every single photo on the
site (since any normal user would not be able to do this).
QUERY -
SELECT
a.user_id, COUNT(*) AS photos_liked, b.username
FROM
likes a
JOIN
users b ON a.user_id = b.id
GROUP BY a.user_id
HAVING photos_liked = 257;
5 257 Aniya_Hackett
14 257 Jaclyn81
21 257 Rocio33
24 257 Maxwell.Halvorson
36 257 Ollie_Ledner37
41 257 Mckenna17
54 257 Duane60
57 257 Julien_Schmidt
66 257 Mike.Auer39
71 257 Nia_Haag
75 257 Leslie67
76 257 Janelle.Nikolaus81
91 257 Bethany20