Built with datascienceportfol.io

Instagram User Analytics

Project photo

Project links

Skills

About this project

Instagram User Analytics Project

This document provides a comprehensive overview of the Instagram User Analytics project, detailing its objectives, methodologies, technical implementation, and key findings.

 

1. Project Description

The Project is based on Instagram User Analytics, where a dataset is given with all variables of the project. Initially, I will go through the given dataset and see the observation of each and every variable table and formulate the output for all perspective tasks.

 

2. Approach

I will study the whole dataset for the given Instagram users, analyze the different data inside the table, and note down the total number of observations for different data available. I will also execute the data for the required task which is mentioned for each task.

3. Database Schema

The database ig_clone was created with several tables to store Instagram user data. The schema is as follows:

  • Users: Stores user information.

    • id: Unique identifier for the user (auto-incrementing primary key).

    • username: User's unique username (VARCHAR, not null).

    • created_at: Timestamp of user creation (default to current time).

  • Photos: Stores details about uploaded photos.

    • id: Unique identifier for the photo (auto-incrementing primary key).

    • image_url: URL of the image (VARCHAR, not null).

    • user_id: Foreign key referencing the users table, indicating the photo owner.

    • created_dat: Timestamp of photo creation (default to current time).

  • Comments: Stores user comments on photos.

    • id: Unique identifier for the comment (auto-incrementing primary key).

    • comment_text: The actual comment text (VARCHAR, not null).

    • user_id: Foreign key referencing the users table, indicating who made the comment.

    • photo_id: Foreign key referencing the photos table, indicating which photo was commented on.

    • created_at: Timestamp of comment creation (default to current time).

  • Likes: Records user likes on photos.

    • user_id: Foreign key referencing the users table.

    • photo_id: Foreign key referencing the photos table.

    • created_at: Timestamp of the like (default to current time).

    • Primary Key: (user_id, photo_id) - ensures a user can only like a photo once.

  • Follows: Records user follow relationships.

    • follower_id: Foreign key referencing the users table (the user who is following).

    • followee_id: Foreign key referencing the users table (the user being followed).

    • created_at: Timestamp of the follow action (default to current time).

    • Primary Key: (follower_id, followee_id) - ensures a unique follow relationship.

  • Tags: Stores hashtag information.

    • id: Unique identifier for the tag (auto-incrementing primary key).

    • tag_name: The tag name (VARCHAR, unique, not null).

    • created_at: Timestamp of tag creation (default to current time).

  • Photo_Tags: A junction table linking photos to tags.

    • photo_id: Foreign key referencing the photos table.

    • tag_id: Foreign key referencing the tags table.

    • Primary Key: (photo_id, tag_id) - ensures a unique photo-tag association.

The database was populated with sample data for users, photos, follows, comments, and photo tags.

 

4. SQL Queries

Various SQL queries were used to extract insights from the database, including:

  • Retrieving all users:

    SQL
    SELECT * FROM ig_clone.users;
    
  • Identifying the 5 oldest users:

    SQL
    SELECT * FROM users
    ORDER BY created_at
    LIMIT 5;
    
  • Finding users who never posted a single photo:

    SQL
    SELECT username
    FROM users
    LEFT JOIN photos ON users.id = photos.user_id
    WHERE photos.id IS NULL;
    
  • Determining the contest winner (most likes on a single photo):

    SQL
    SELECT
        username,
        photos.id,
        photos.image_url,
        COUNT(*) AS total
    FROM photos
    INNER JOIN likes
        ON likes.photo_id = photos.id
    INNER JOIN users
        ON photos.user_id = users.id
    GROUP BY photos.id
    ORDER BY total DESC
    LIMIT 1;
    
  • Identifying the top 5 most commonly used hashtags:

    SQL
    SELECT tag_name, COUNT(tag_name) AS total
    FROM tags
    JOIN photo_tags ON tags.id = photo_tags.tag_id
    GROUP BY tags.id
    ORDER BY total DESC;
    
  • Analyzing user registration by day of the week:

    SQL
    SELECT
        DAYNAME(created_at) AS day,
        COUNT(*) AS total
    FROM users
    GROUP BY day
    ORDER BY total DESC
    LIMIT 2;
    
  • Calculating the average user posts on Instagram:

    SQL
    SELECT ROUND((SELECT COUNT(*)FROM photos)/(SELECT COUNT(*) FROM users),2);
    

 

5. Key Findings and Results

Based on the analysis, the following key findings were identified to meet the marketing team's requirements:

  • Rewarding Most Loyal Users: The 5 oldest users from the dataset were identified.

    • Darby_Herzog (ID: 80, Created: 2016-05-06 00:14:21)

    • Emilio_Bernier52 (ID: 67, Created: 2016-05-06 13:04:30)

    • Elenor88 (ID: 63, Created: 2016-05-08 01:30:41)

    • Nicole71 (ID: 95, Created: 2016-05-09 17:30:22)

    • Jordyn.Jacobson2 (ID: 38, Created: 2016-05-14 07:56:26) (Total of 100 users available in the dataset)

  • Reminding Inactive Users to Start Posting: Out of 257 users, 26 users never posted a single photo on Instagram. Examples include:

    • Aniya_Hackett

    • Kasandra_Homenick

    • Jaclyn81

    • Rocio33

    • Maxwell.Halvorson

    • Tierra.Trantow

    • Pearl7

    • Ollie_Ledner37

    • Mckenna17

    • David.Osinski47

    • Morgan.Kassulke

    • Linnea59

    • Duane60

    • Julien_Schmidt

    • Mike.Auer39

    • Franco_Keebler64

    • Nia_Haag

    • Hulda.Macejkovic

    • Leslie67

    • Janelle.Nikolaus81

    • Darby_Herzog

    • Esther.Zulauf61

    • Bartholome.Bernhard

    • Jessyca_West

    • Esmeralda.Mraz57

    • Bethany20

  • Declaring Contest Winner: The contest winner was Zack_Kemmer93, with 48 likes on their photo (ID: 145, Image URL: https://jarret.name).

  • Hashtag Research: The top 5 most commonly used hashtags were:

    • smile (59 uses)

    • beach (42 uses)

    • party (39 uses)

    • fun (38 uses)

    • concert (24 uses)

  • Launch AD Campaign (User Registration Day): The days with the highest user registrations were Thursday and Sunday, both with 16 registrations.

 

6. Tech-Stack Used

The project utilized MySQL Workbench 8.0 CE as the primary software for SQL database operations. MySQL Workbench was chosen for its user-friendly interface, ease of testing, debugging, and efficient code execution.

 

7. Insights and Learnings

Through this project, valuable insights were gained into:

  • The basic understanding of SQL software.

  • Analyzing Instagram user data.

  • The practical application of SQL commands such as SELECT, ORDER BY, WHERE, JOIN, and GROUP BY for data retrieval and manipulation.

While Microsoft SQL Server and Db Fiddle were initially considered, MySQL Workbench proved to be the most suitable application due to its fewer constraints with the project files.

 

8. Result

This project successfully delivered the required Instagram user analytics, providing valuable insights into user behavior and platform trends. The experience enhanced understanding of SQL concepts and database analysis, which will be beneficial for future data-related projects.