Skip to content

akshayremesh7/Social-Media-SQL-Analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Social Media SQL Analytics Project

A fully relational SQL project that simulates a real social media platform with users, posts, likes, comments, followers, messages, and hashtags.

Built with PostgreSQL and designed for advanced SQL analytics and portfolio demonstration.

πŸš€ Project Overview

This project models the core features of platforms like Instagram or Twitter using pure SQL.

You can perform:

User analytics

Engagement analysis

Ranking & leaderboards

Follower network analysis

Post performance insights

Window functions

CTE-based queries

Data relationships analysis

Everything is designed to match real industry database standards.

🧱 Database Schema

This database contains the following tables:

Table Description

users User profiles and account info

posts User posts with optional images

likes Likes on posts

comments User comments on posts

follows Follower–following relationships

hashtags Hashtags used on posts

post_hashtags Mapping posts ↔ hashtags

messages Direct messages between users

The schema includes foreign keys, CASCADE deletes, unique constraints, and primary keys.

πŸ“ All table definitions are in:

schema/create_tables.sql

πŸ“₯ Sample Data

The project includes fully realistic sample data:

5 users

5 posts

Likes, comments, followers

Non-conflicting inserts

Clean and simple structure

πŸ“ Sample data file:

data/sample_inserts.sql

You can load the data by running this script in pgAdmin or psql.

πŸ“Š Analytics & SQL Queries

The project contains 20 advanced SQL queries, including:

βœ” Most liked posts

βœ” Posts with highest comments

βœ” Top influencers

βœ” Mutual followers

βœ” User engagement rate

βœ” Most active users

βœ” Window functions: RANK()

βœ” Users with no posts

βœ” Likes and comments received

βœ” Comment ranking

βœ” Post/follower ratio

πŸ“ Analytics queries are in:

queries/analytics_queries.sql

These queries demonstrate real-world SQL skills useful for interviews and data roles.

πŸ›  Tech Stack

PostgreSQL 16+

pgAdmin 4

Pure SQL (no backend or Python required)

πŸ”§ How to Run

Create a new database:

CREATE DATABASE social_media_db;

Run table schema:

schema/create_tables.sql

Insert sample data:

data/sample_inserts.sql

Run analytics:

queries/analytics_queries.sql

πŸ“ˆ Why This Project is Valuable

This project demonstrates:

Advanced SQL skills

Database design knowledge

Real social media relational modeling

Analytical thinking

Clean GitHub project structure

Interview-ready queries

Perfect for showcasing SQL + database skills in your portfolio.

πŸ‘¨β€πŸ’» Created By

Akshay R

(SQL, Python & Data Analytics Student)

About

A complete SQL social media analytics project using PostgreSQL. Includes schema, sample data, analytics queries, and ER diagram.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors