INSTAGRAM USER ANALYTICS.
SYNOPSIS
ER DIAGRAM:
YOU ARE REQUIRED TO PROVIDE A DETAILED REPORT ANSWERING THE QUESTIONS BELOW :
Task1. 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
Ans: Sql-select * from users order by created_at limit 5;
id | Username | Created_at |
80 | Darby_Herzog | 2016-05-06 00:14:21 |
67 | Emilio_Bernier52 | 2016-05-06 13:04:30 |
63 | Elenor88 | 2016-05-08 01:30:41 |
95 | Nicole71 | 2016-05-09 17:30:22 |
38 | Jordyn.Jacobson2 | 2016-05-14 07:56:26 |
| | |
WORKING TASK 1:-�
TASK2:-FIND THE USERS WHO HAVE NEVER POSTED A SINGLE PHOTO ON INSTAGRAM.
WORKING TASK 2:-
When we know we have to use join now the question arises which join is best suitable here as there are many joins.
Here in this task we have to use left join, with select we have to choose username from users and else from the left table which is photos, and by joining these two tables we will got the result which is the username.
TASK3:- IDENTIFY THE WINNER OF THE CONTEST AND PROVIDE THEIR DETAILS TO THE TEAM
So this will give us only one result which helps Marketing team to declare the Contest Winner. Here we have used joins to join the 2 tables so that we got the desired filtering and to get the appropriate result.
username | id | Image_url | Total_likes |
Harley_Lind18 | 145 | https://jarret.name | 48 |
WORKING TASK3:-
For fetching the result we need to connect three tables ‘USERS’, ‘PHOTOS’ and ‘LIKES’
We have used Count function to count the total no of likes and Order by is also used based on total likes so that the who will get the maximum result will be in the top of the list and then we have used LIMIT clause which is used to give the particular row.
TASK4: IDENTIFY AND SUGGEST THE TOP 5 MOST COMMONLY USED HASHTAGS ON THE PLATFORM.
tags.id = photo_tags.tag_id group by tags.id order by total desc limit 5;
tag_name | total |
Smile | 59 |
Beach | 42 |
Party | 39 |
Fun | 38 |
Concert | 24 |
| |
WORKING TASK 4:-
TASK 5: WHAT DAY OF THE WEEK DO MOST USERS REGISTER ON? PROVIDE INSIGHTS ON WHEN TO SCHEDULE AN AD CAMPAIGN
Sql: Select date_format (created_at,'%W’) as 'day of the week’, count(*) AS 'total registration’ FROM users group by 1order by 2 DESC
Day of the week | Total registration |
Thrusday | 16 |
Sunday | 16 |
Friday | 15 |
Tuesday | 14 |
Monday | 14 |
Wednesday | 13 |
Saturday | 12 |
WORKING TASK 5:-�
TASK6:- 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).
Id | Username | Total_likes |
5 | 'Aniya_Hackett' | 257 |
14 | 'Jaclyn81' | 257 |
21 | 'Rocio33' | 257 |
24 | 'Maxwell.Halvorson' | 257 |
36 | 'Ollie_Ledner37' | 257 |
41 | 'Mckenna17' | 257 |
54 | 'Duane60' | 257 |
57 | 'Julien_Schmidt' | 257 |
WORKING TASK 6:-
CONCLUSION:-�
THANK YOU.