TGViewer
Channel Public Channel
SQL Programming Resources

SQL Programming Resources

@sqlanalyst

Find top SQL resources from global universities, cool projects, and learning materials for data analytics.

Admin: @coderfun

Useful links: heylink.me/DataAnalytics

Promotions: @love_data
Subscribers
76.7K
Photos
601
Videos
1
Links
571

Showing posts older than #2674 ยท Back to latest

Older Posts 20 shown
Post #2673 1.9K
๐Ÿš€ ๐Ÿฐ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜๐—ผ ๐—•๐—ผ๐—ผ๐˜€๐˜ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฅ๐—ฒ๐˜€๐˜‚๐—บ๐—ฒ & ๐—–๐—ผ๐—ป๐—ณ๐—ถ๐—ฑ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐ŸŽ“๐Ÿ”ฅ

Make your resume stand out and feel more confident during your job search.

๐Ÿš€ Build confidence and a career-focused mindset

โœ… 100% FREE
โœ… Beginner Friendly
โœ… Improve Your Resume
โœ… Develop Career-Ready Skills
โœ… Great for Students, Freshers & Professionals

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4gce062

๐Ÿ”ฅ Don't just apply for jobs โ€” build the skills and confidence to stand out!
  • โค 1
Post #2672 2.03K
SELECT d.department_name, COUNT(e.employee_id) AS employee_count
FROM departments d
LEFT JOIN employees e ON d.department_id = e.department_id
GROUP BY d.department_name
ORDER BY employee_count DESC;


๐Ÿ’ก Example 2: Average Salary by Department

SELECT d.department_name, ROUND(AVG(e.salary), 2) AS average_salary
FROM employees e
JOIN departments d ON e.department_id = d.department_id
GROUP BY d.department_name
ORDER BY average_salary DESC;


๐Ÿ’ก Example 3: Identify Highest-Paid Employees

SELECT employee_name, job_title, salary
FROM employees
ORDER BY salary DESC
LIMIT 10;


๐Ÿ’ก Example 4: Calculate Attrition Rate

SELECT ROUND(100.0 * SUM(CASE WHEN employment_status = 'Resigned' THEN 1 ELSE 0 END) / COUNT(*), 2) AS attrition_rate
FROM employees;


๐Ÿ’ก Example 5: Calculate Attendance Rate

SELECT employee_id, ROUND(100.0 * SUM(CASE WHEN attendance_status = 'Present' THEN 1 ELSE 0 END) / COUNT(*), 2) AS attendance_rate
FROM attendance
GROUP BY employee_id;


๐Ÿ’ก Example 6: Rank Employees by Salary

SELECT employee_name, department_id, salary, DENSE_RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) AS salary_rank
FROM employees;


๐Ÿ’ก Example 7: Find Employees Who Were Promoted

SELECT e.employee_name, p.old_job_title, p.new_job_title, p.promotion_date
FROM employees e
JOIN promotions p ON e.employee_id = p.employee_id
ORDER BY p.promotion_date;


๐ŸŽฏ Key Insights You Can Derive

๐Ÿ”น Which departments have the highest headcount?

๐Ÿ”น Which departments have the highest attrition?

๐Ÿ”น Which roles have the highest salaries?

๐Ÿ”น Which employees have been promoted?

๐Ÿ”น What is the average employee tenure?

๐Ÿ”น Which departments have attendance problems?

๐Ÿ”น How quickly is the organization growing?

๐Ÿ”น Where are the biggest employee retention challenges?

๐Ÿ’ผ Double Tap โค๏ธ For More
  • โค 8
Post #2671 1.9K
๐Ÿš€ SQL Project Series #35

HR & Employee Analytics ๐Ÿ‘ฅ

Analyze employees, departments, salaries, attendance, promotions, and attrition using SQL to understand workforce trends and improve HR decision-making.

๐ŸŽฏ Business Objectives

โœ… Analyze employee headcount

โœ… Track employee attrition

โœ… Analyze salary distribution

โœ… Measure department performance

โœ… Identify high-performing employees

โœ… Analyze promotions and tenure

โœ… Track attendance

โœ… Build HR analytics dashboards

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE hr_analytics_db;
USE hr_analytics_db;


๐Ÿ“‚ Step 2: Create Departments Table

CREATE TABLE departments (
department_id INT PRIMARY KEY,
department_name VARCHAR(100),
location VARCHAR(50)
);


๐Ÿ“‚ Step 3: Create Employees Table

CREATE TABLE employees (
employee_id INT PRIMARY KEY,
employee_name VARCHAR(100),
department_id INT,
job_title VARCHAR(100),
hire_date DATE,
salary DECIMAL(12,2),
employment_status VARCHAR(20),
FOREIGN KEY (department_id) REFERENCES departments(department_id)
);


๐Ÿ“‚ Step 4: Create Attendance Table

CREATE TABLE attendance (
attendance_id INT PRIMARY KEY,
employee_id INT,
attendance_date DATE,
attendance_status VARCHAR(20),
FOREIGN KEY (employee_id) REFERENCES employees(employee_id)
);


๐Ÿ“‚ Step 5: Create Promotions Table

CREATE TABLE promotions (
promotion_id INT PRIMARY KEY,
employee_id INT,
promotion_date DATE,
old_job_title VARCHAR(100),
new_job_title VARCHAR(100),
FOREIGN KEY (employee_id) REFERENCES employees(employee_id)
);


๐Ÿ“‚ Step 6: Insert Sample Departments

INSERT INTO departments VALUES
(101,'Data Analytics','Mumbai'),
(102,'Finance','Delhi'),
(103,'Human Resources','Bangalore'),
(104,'Technology','Pune'),
(105,'Operations','Hyderabad');


๐Ÿ“‚ Step 7: Insert Sample Employees

INSERT INTO employees VALUES
(1,'Rahul Sharma',101,'Data Analyst','2022-01-10',850000,'Active'),
(2,'Priya Verma',102,'Financial Analyst','2021-05-15',920000,'Active'),
(3,'Amit Patel',104,'Software Engineer','2020-08-20',1200000,'Active'),
(4,'Sneha Joshi',103,'HR Specialist','2023-02-10',650000,'Active'),
(5,'Rohan Gupta',105,'Operations Analyst','2022-11-05',750000,'Resigned');


๐Ÿ“‚ Step 8: Insert Sample Attendance

INSERT INTO attendance VALUES
(1,1,'2025-01-02','Present'),
(2,1,'2025-01-03','Present'),
(3,2,'2025-01-02','Present'),
(4,2,'2025-01-03','Absent'),
(5,3,'2025-01-02','Present'),
(6,4,'2025-01-02','Present'),
(7,5,'2025-01-02','Absent');


๐Ÿ“‚ Step 9: Insert Sample Promotions

INSERT INTO promotions VALUES
(1,1,'2024-06-01','Junior Data Analyst','Data Analyst'),
(2,3,'2024-01-15','Software Engineer','Senior Software Engineer');


๐Ÿง  SQL Concepts You'll Practice

โœ” INNER JOIN

โœ” LEFT JOIN

โœ” GROUP BY

โœ” HAVING

โœ” CASE WHEN

โœ” Aggregate Functions

โœ” CTEs

โœ” Subqueries

โœ” Window Functions

โœ” RANK()

โœ” DENSE_RANK()

โœ” LAG()

โœ” Date Functions

โœ” Conditional Aggregation

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Total Employees

๐Ÿ“ˆ Active Employees

๐Ÿ“ˆ Employee Attrition Rate

๐Ÿ“ˆ Monthly Hiring Rate

๐Ÿ“ˆ Monthly Attrition Rate

๐Ÿ“ˆ Employee Retention Rate

๐Ÿ“ˆ Average Salary

๐Ÿ“ˆ Median Salary

๐Ÿ“ˆ Salary by Department

๐Ÿ“ˆ Salary by Job Title

๐Ÿ“ˆ Gender Distribution

๐Ÿ“ˆ Employee Tenure

๐Ÿ“ˆ Average Tenure

๐Ÿ“ˆ Promotion Rate

๐Ÿ“ˆ Employees Promoted

๐Ÿ“ˆ Attendance Rate

๐Ÿ“ˆ Absenteeism Rate

๐Ÿ“ˆ Department Headcount

๐Ÿ“ˆ Department Attrition Rate

๐Ÿ“ˆ Highest Paid Employees

๐Ÿ“ˆ Salary Distribution

๐Ÿ“ˆ Hiring Trend

๐Ÿ“ˆ Employee Growth

๐Ÿ“ˆ Executive HR Dashboard

๐Ÿ’ก Example 1: Department-wise Employee Count
  • โค 4
Post #2670 1.96K
๐Ÿ“Š ๐—•๐˜‚๐—ถ๐—น๐—ฑ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐——๐—ฎ๐˜๐—ฎ ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜€๐˜ ๐—ฃ๐—ผ๐—ฟ๐˜๐—ณ๐—ผ๐—น๐—ถ๐—ผ | ๐Ÿฑ ๐—›๐—ฎ๐—ป๐—ฑ๐˜€-๐—ข๐—ป ๐—ฃ๐—ฟ๐—ผ๐—ท๐—ฒ๐—ฐ๐˜๐˜€ ๐Ÿš€

Learning Data Analytics? Don't stop with tutorials โ€” build real projects that you can showcase on your resume and portfolio! ๐Ÿ’ป

๐Ÿ”ฅ Practice with 5 Hands-On Projects covering:

๐Ÿ—„๏ธ SQL
๐Ÿ“Š Excel
๐Ÿ“ˆ Tableau
๐Ÿ“‰ Power BI

๐Ÿ”—๐—Ÿ๐—ถ๐—ป๐—ธ ๐Ÿ‘‡:- 

https://pdlink.in/45LLDH7

๐ŸŽ“ Perfect for Students | Freshers | Data Analyst Aspirants | Beginners
Post #2669 2.2K
๐Ÿ“Š ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ ๐Ÿš€

Want to start a career in Data Analytics & Business Intelligence? Learn Power BI through Microsoft learning modules and build practical, job-relevant analytics skills.

๐ŸŽฏ Perfect for Students | Freshers | Data Analyst Aspirants | Working Professionals

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4zhGTX6

๐Ÿ”ฅ Start learning Power BI and turn raw data into powerful business insights!
  • โค 2
Post #2668 2.2K
๐—”๐—œ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ ๐Ÿ˜

Build real AI products - not just prompts

๐ŸŽฏ Program Highlights:-

๐Ÿš€ 15+ AI Projects
๐Ÿ‘จโ€๐Ÿซ Live Online Classes + 1-on-1 Mentorship
๐Ÿ’ผ End-to-End Placement Support
๐Ÿค 500+ Partner Companies
๐ŸŽ“ 2000+ Students Placed
๐Ÿ’ฐ Average Salary: โ‚น7.4 LPA
๐Ÿ† Highest Salary: โ‚น41 LPA

๐Ÿ”— ๐—•๐—ผ๐—ผ๐—ธ ๐—ฎ ๐—™๐—ฅ๐—˜๐—˜ ๐——๐—ฒ๐—บ๐—ผ ๐—–๐—น๐—ฎ๐˜€๐˜€:-

https://pdlink.in/4fWJVID

๐Ÿ”ฅ Learn AI โ†’ Build Real Projects โ†’ Create Your Portfolio โ†’ Become Job Ready
  • โค 2
Post #2667 2.15K
๐ŸŽฏ Key Insights You Can Derive

๐Ÿ”น Which products generate the most revenue?

๐Ÿ”น Which stores have the highest sales?

๐Ÿ”น When do customers place the most orders?

๐Ÿ”น Which cities have the strongest demand?

๐Ÿ”น What percentage of orders are cancelled?

๐Ÿ”น Which customers make repeat purchases?

๐Ÿ”น Which categories contribute most to revenue?

๐Ÿ”น How efficiently are orders being delivered?

Double Tap โค๏ธ For More
  • โค 4
Post #2666 2.16K
๐Ÿš€ SQL Project Series #34

Food & Grocery Delivery Analytics ๐Ÿ›’

Analyze customers, stores, products, orders, deliveries, and payments to understand sales performance, customer behavior, delivery efficiency, and operational costs.

๐ŸŽฏ Business Objectives

โœ… Analyze order and revenue trends

โœ… Identify top-selling products

โœ… Measure customer retention

โœ… Analyze store performance

โœ… Track delivery efficiency

โœ… Identify peak ordering periods

โœ… Monitor cancellations and refunds

โœ… Optimize product and store performance

๐Ÿ“‚ Database Setup

CREATE DATABASE grocery_delivery_db;
USE grocery_delivery_db;


Tables Created:

customers โ†’ customer_id, customer_name, city, signup_date

stores โ†’ store_id, store_name, city, store_type

products โ†’ product_id, product_name, category, price

orders โ†’ order_id, customer_id, store_id, order_date, order_status, delivery_time_minutes, delivery_fee

order_items โ†’ order_item_id, order_id, product_id, quantity, unit_price

Sample data for 5 customers, 4 stores, 5 products, 5 orders already included.

๐Ÿง  SQL Concepts You'll Practice

โœ” INNER JOIN, LEFT JOIN

โœ” Aggregate Functions, GROUP BY, HAVING

โœ” CASE WHEN, CTEs, Subqueries

โœ” Window Functions

โœ” Date & Time Functions

โœ” Conditional Aggregation

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Total Orders, Completed Orders, Cancelled Orders, Cancellation Rate

๐Ÿ“ˆ Total Revenue, AOV, Average Basket Size, Items Sold

๐Ÿ“ˆ Revenue by Category, Store, City

๐Ÿ“ˆ Top-Selling / Low-Selling Products

๐Ÿ“ˆ Customer Lifetime Value, Repeat Purchase Rate, Retention Rate

๐Ÿ“ˆ Average Delivery Time, On-Time Delivery Rate

๐Ÿ“ˆ Peak Ordering Hour, Peak Ordering Day, Monthly Revenue Growth

๐Ÿ“ˆ Delivery Fee Revenue, Customer Acquisition Trend

๐Ÿ“ˆ Executive Grocery Delivery Dashboard

๐Ÿ’ก Example Queries

1. Total Revenue

SELECT SUM(oi.quantity * oi.unit_price) AS total_revenue
FROM orders o
JOIN order_items oi ON o.order_id = oi.order_id
WHERE o.order_status = 'Delivered';


2. Top-Selling Products

SELECT p.product_name, SUM(oi.quantity) AS units_sold
FROM products p
JOIN order_items oi ON p.product_id = oi.product_id
JOIN orders o ON oi.order_id = o.order_id
WHERE o.order_status = 'Delivered'
GROUP BY p.product_name
ORDER BY units_sold DESC
LIMIT 10;


3. Average Order Value

WITH order_values AS (
SELECT o.order_id, SUM(oi.quantity * oi.unit_price) AS order_value
FROM orders o
JOIN order_items oi ON o.order_id = oi.order_id
WHERE o.order_status = 'Delivered'
GROUP BY o.order_id
)
SELECT ROUND(AVG(order_value), 2) AS average_order_value FROM order_values;


4. Repeat Customers

SELECT customer_id, COUNT(order_id) AS total_orders
FROM orders
WHERE order_status = 'Delivered'
GROUP BY customer_id
HAVING COUNT(order_id) > 1;


5. Revenue by Store

SELECT s.store_name, SUM(oi.quantity * oi.unit_price) AS revenue
FROM stores s
JOIN orders o ON s.store_id = o.store_id
JOIN order_items oi ON o.order_id = oi.order_id
WHERE o.order_status = 'Delivered'
GROUP BY s.store_name
ORDER BY revenue DESC;


6. Cancellation Rate

SELECT ROUND(100.0 * SUM(CASE WHEN order_status = 'Cancelled' THEN 1 ELSE 0 END) / COUNT(*), 2) AS cancellation_rate
FROM orders;


7. Peak Ordering Hours

SELECT EXTRACT(HOUR FROM order_date) AS order_hour, COUNT(*) AS total_orders
FROM orders
WHERE order_status = 'Delivered'
GROUP BY EXTRACT(HOUR FROM order_date)
ORDER BY total_orders DESC;
  • โค 6
  • ๐Ÿ˜ 1
Post #2665 1.85K
๐Ÿ‡ฎ๐Ÿ‡ณ ๐—™๐—ฅ๐—˜๐—˜ ๐—š๐—ผ๐˜ƒ๐—ฒ๐—ฟ๐—ป๐—บ๐—ฒ๐—ป๐˜-๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฑ ๐—ข๐—ป๐—น๐—ถ๐—ป๐—ฒ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐ŸŽ“

Upgrade your skills with *SWAYAM*, an initiative by the Government of India!

โœ… Learn from leading institutes and expert educators
โœ… Courses in AI, Programming, Data Science, Business & more
โœ… Suitable for students, freshers and professionals
โœ… Learn online at your own pace
โœ… Strengthen your rรฉsumรฉ with valuable certifications

๐Ÿ”— ๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4gc1MKx

๐Ÿ“ข Share this opportunity with your friends and classmates!
Post #2664 2.56K
๐Ÿš€ DATA ANALYTICS + AI: YOUR NEXT CAREER MOVE!

Data is everywhere. The right skills can put you ahead.
Join the PW Skills Data Analytics With AI Course and learn Excel, SQL, Python, Power BI & AI tools through live sessions and real-world projects.

โœจ What you get:
โœ… Industry-relevant Data Analytics skills
โœ… AI-powered learning
โœ… Microsoft collaboration
โœ… Hands-on projects
โœ… Job assistance*
โœ… Live classes in Hinglish

๐Ÿ“… Starts: 14th August 2026
โณ Duration: 5 Months
๐Ÿ”ฅ Ready to become a future-ready Data Analyst?
๐Ÿ‘‰
Enroll Now & Start Your Upskilling Journey!
https://lp.pwskills.com/data-analytics-with-gen-ai-online-course?utm_source=telegram&utm_medium=influencer&utm_campaign=deepakDAonline
Post #2663 1.98K
WITH ranked_videos AS (
    SELECT
        video_title,
        category,
        views,
        ROW_NUMBER() OVER (
            PARTITION BY category
            ORDER BY views DESC
        ) AS rn
    FROM videos
)
SELECT
    video_title,
    category,
    views
FROM ranked_videos
WHERE rn = 1;


๐Ÿ’ก Example 4: Calculate Channel Performance 
SELECT
    c.channel_name,
    COUNT(v.video_id) AS total_videos,
    SUM(v.views) AS total_views,
    SUM(v.likes) AS total_likes,
    SUM(v.comments) AS total_comments
FROM channels c
LEFT JOIN videos v
    ON c.channel_id = v.channel_id
GROUP BY c.channel_name
ORDER BY total_views DESC;

๐Ÿ’ก Example 5: Analyze Publishing Performance 
SELECT
    EXTRACT(DOW FROM publish_date) AS day_of_week,
    COUNT(*) AS total_videos,
    ROUND(AVG(views), 0) AS avg_views
FROM videos
GROUP BY EXTRACT(DOW FROM publish_date)
ORDER BY avg_views DESC;

๐Ÿ’ก Example 6: Rank Videos by Views 
SELECT
    video_title,
    views,
    DENSE_RANK() OVER (
        ORDER BY views DESC
    ) AS view_rank
FROM videos;

๐ŸŽฏ Key Insights You Can Derive

๐Ÿ”น Which videos generate the most views? 
๐Ÿ”น Which content categories perform best? 
๐Ÿ”น Which videos have high engagement but relatively low views? 
๐Ÿ”น What publishing days generate the most views? 
๐Ÿ”น Which channels have the strongest audience engagement? 
๐Ÿ”น Which content contributes most to subscriber growth? 
๐Ÿ”น Which videos should be promoted further? 

๐Ÿ’ผ This project is especially useful for Data Analysts, Product Analysts, Growth Analysts, Marketing Analysts, and Business Intelligence professionals working with content, media, and digital platforms.

Double Tap โค๏ธ For More
  • โค 6
Post #2662 1.9K
๐Ÿš€ SQL Project Series #33

YouTube Channel Analytics ๐Ÿ“บ

Analyze videos, creators, views, watch time, engagement, and subscriber growth using SQL to understand content performance and audience behavior.

๐ŸŽฏ Business Objectives

โœ… Analyze video performance
โœ… Track subscriber growth
โœ… Measure audience engagement
โœ… Identify top-performing content
โœ… Compare video categories
โœ… Analyze watch time
โœ… Identify high-performing creators
โœ… Discover the best publishing times

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE youtube_analytics_db;
USE youtube_analytics_db;


๐Ÿ“‚ Step 2: Create Channels Table

CREATE TABLE channels (
channel_id INT PRIMARY KEY,
channel_name VARCHAR(100),
category VARCHAR(50),
country VARCHAR(50),
created_date DATE
);


๐Ÿ“‚ Step 3: Create Videos Table

CREATE TABLE videos (
video_id INT PRIMARY KEY,
channel_id INT,
video_title VARCHAR(200),
category VARCHAR(50),
publish_date DATETIME,
duration_minutes DECIMAL(6,2),
views BIGINT,
likes INT,
comments INT,
shares INT,
FOREIGN KEY (channel_id)
REFERENCES channels(channel_id)
);


๐Ÿ“‚ Step 4: Create Subscribers Table

CREATE TABLE subscribers (
subscriber_id INT PRIMARY KEY,
channel_id INT,
subscribe_date DATE,
unsubscribe_date DATE,
FOREIGN KEY (channel_id)
REFERENCES channels(channel_id)
);


๐Ÿ“‚ Step 5: Insert Sample Channels

INSERT INTO channels VALUES
(1,'Data Simplifier','Education','India','2023-01-10'),
(2,'Tech World','Technology','India','2022-08-15'),
(3,'Finance Explained','Finance','USA','2021-05-20'),
(4,'Travel Diaries','Travel','India','2023-04-12');


๐Ÿ“‚ Step 6: Insert Sample Videos

INSERT INTO videos VALUES
(101,1,'SQL Interview Questions','Education','2025-01-05 10:00:00',12,15000,900,120,80),
(102,1,'Power BI Dashboard Tutorial','Education','2025-01-08 18:00:00',18,22000,1400,180,150),
(103,2,'Best AI Tools','Technology','2025-01-10 12:00:00',10,35000,2800,310,420),
(104,3,'How to Invest','Finance','2025-01-12 09:00:00',15,28000,2100,250,300),
(105,4,'Top Places in India','Travel','2025-01-15 20:00:00',14,19000,1300,170,200);


๐Ÿ“‚ Step 7: Insert Sample Subscribers

INSERT INTO subscribers VALUES
(1001,1,'2025-01-01',NULL),
(1002,1,'2025-01-03',NULL),
(1003,1,'2025-01-05','2025-03-01'),
(1004,2,'2025-01-02',NULL),
(1005,3,'2025-01-04',NULL),
(1006,4,'2025-01-10',NULL);


๐Ÿง  SQL Concepts You'll Practice

โœ” Joins
โœ” GROUP BY
โœ” HAVING
โœ” CASE WHEN
โœ” CTEs
โœ” Subqueries
โœ” Window Functions
โœ” Ranking
โœ” Date & Time Functions
โœ” Conditional Aggregation

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Total Channels
๐Ÿ“ˆ Total Videos
๐Ÿ“ˆ Total Views
๐Ÿ“ˆ Total Likes
๐Ÿ“ˆ Total Comments
๐Ÿ“ˆ Total Shares
๐Ÿ“ˆ Total Subscribers
๐Ÿ“ˆ Subscriber Growth Rate
๐Ÿ“ˆ Subscriber Churn Rate
๐Ÿ“ˆ Average Views per Video
๐Ÿ“ˆ Average Likes per Video
๐Ÿ“ˆ Average Comments per Video
๐Ÿ“ˆ Engagement Rate
๐Ÿ“ˆ Like-to-View Ratio
๐Ÿ“ˆ Comment-to-View Ratio
๐Ÿ“ˆ Share-to-View Ratio
๐Ÿ“ˆ Watch Time
๐Ÿ“ˆ Average Video Duration
๐Ÿ“ˆ Top 10 Videos by Views
๐Ÿ“ˆ Top Videos by Engagement
๐Ÿ“ˆ Top Performing Categories
๐Ÿ“ˆ Channel-wise Performance
๐Ÿ“ˆ Views by Publishing Day
๐Ÿ“ˆ Views by Publishing Hour
๐Ÿ“ˆ Monthly Views Growth
๐Ÿ“ˆ Subscriber Growth by Month
๐Ÿ“ˆ Content Performance Dashboard

๐Ÿ’ก Example 1: Find Top 5 Videos by Views

SELECT
video_title,
views
FROM videos
ORDER BY views DESC
LIMIT 5;


๐Ÿ’ก Example 2: Calculate Engagement Rate

SELECT
video_title,
views,
likes,
comments,
shares,
ROUND(
100.0 * (likes + comments + shares) / NULLIF(views, 0),
2
) AS engagement_rate
FROM videos
ORDER BY engagement_rate DESC;


๐Ÿ’ก Example 3: Find Top Video in Each Category
  • โค 5
Post #2661 1.67K
๐Ÿš€ ๐—š๐—ผ๐—ผ๐—ด๐—น๐—ฒ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐ŸŽ“

Want to upgrade your resume with Google skills and certifications Explore FREE learning opportunities and build in-demand skills for today's job market.

๐Ÿ‘‰Artificial Intelligence & Generative AI
๐Ÿ“Š Data Analytics
โ˜๏ธ Cloud Computing
๐Ÿ“ข Digital Marketing
๐Ÿ” Cybersecurity
๐Ÿ’ป Tech & Career Skills

๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4z9pdgf

๐Ÿ”ฅ Don't just collect certificates โ€” build skills that can help you stand out in 2026!
Post #2660 1.55K
๐Ÿง  SQL Concepts You'll Practice

โœ” Joins

โœ” GROUP BY

โœ” HAVING

โœ” CASE WHEN

โœ” CTEs

โœ” Subqueries

โœ” Window Functions

โœ” LAG()

โœ” LEAD()

โœ” Date Functions

โœ” Conditional Aggregation

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Monthly Recurring Revenue (MRR)

๐Ÿ“ˆ Annual Recurring Revenue (ARR)

๐Ÿ“ˆ Average Revenue Per User (ARPU)

๐Ÿ“ˆ Customer Lifetime Value (CLV)

๐Ÿ“ˆ Monthly Customer Churn Rate

๐Ÿ“ˆ Revenue Churn Rate

๐Ÿ“ˆ Customer Retention Rate

๐Ÿ“ˆ New Customers, New MRR

๐Ÿ“ˆ Expansion MRR, Contraction MRR, Churned MRR

๐Ÿ“ˆ Net Revenue Retention (NRR), Gross Revenue Retention (GRR)

๐Ÿ“ˆ Upgrade Rate, Downgrade Rate

๐Ÿ“ˆ Plan-wise Revenue, Active Subscriptions, Cancelled Subscriptions

๐Ÿ“ˆ Payment Success Rate, Failed Payment Rate

๐Ÿ“ˆ Monthly Revenue Growth, Revenue Contribution by Plan

๐Ÿ“ˆ Customer Segmentation

๐Ÿ’ก Example 1: Calculate MRR
SELECT
    SUM(p.monthly_price) AS mrr
FROM subscriptions s
JOIN plans p ON s.plan_id = p.plan_id
WHERE s.subscription_status = 'Active';

๐Ÿ’ก Example 2: Revenue by Plan
SELECT
    p.plan_name,
    COUNT(s.subscription_id) AS active_subscriptions,
    SUM(p.monthly_price) AS monthly_revenue
FROM subscriptions s
JOIN plans p ON s.plan_id = p.plan_id
WHERE s.subscription_status = 'Active'
GROUP BY p.plan_name
ORDER BY monthly_revenue DESC;

๐Ÿ’ก Example 3: Identify Churned Customers
SELECT
    customer_id,
    subscription_id,
    end_date
FROM subscriptions
WHERE subscription_status = 'Cancelled';

๐Ÿ’ก Example 4: Calculate Upgrade vs Downgrade Count
SELECT
    change_type,
    COUNT(*) AS total_changes
FROM subscription_changes
GROUP BY change_type;

๐Ÿ’ก Example 5: Calculate Average Revenue Per Customer
SELECT
    ROUND(SUM(p.monthly_price) / COUNT(DISTINCT s.customer_id), 2) AS arpu
FROM subscriptions s
JOIN plans p ON s.plan_id = p.plan_id
WHERE s.subscription_status = 'Active';

๐Ÿ’ก Example 6: Rank Customers by MRR
WITH customer_mrr AS (
    SELECT
        s.customer_id,
        SUM(p.monthly_price) AS mrr
    FROM subscriptions s
    JOIN plans p ON s.plan_id = p.plan_id
    WHERE s.subscription_status = 'Active'
    GROUP BY s.customer_id
)
SELECT
    customer_id,
    mrr,
    DENSE_RANK() OVER (ORDER BY mrr DESC) AS revenue_rank
FROM customer_mrr;

๐ŸŽฏ Key Insights You Can Derive

๐Ÿ”น Which subscription plan generates the most revenue?

๐Ÿ”น Which plan has the highest churn?

๐Ÿ”น How much MRR comes from new customers?

๐Ÿ”น How much revenue is lost through cancellations?

๐Ÿ”น Which customers have upgraded or downgraded?

๐Ÿ”น Is revenue growing month over month?

๐Ÿ”น Which customers contribute the most recurring revenue?

๐Ÿ’ผ This project is especially useful for Data Analysts, Product Analysts, Revenue Analysts, Growth Analysts, and Business Intelligence professionals working with SaaS and subscription-based businesses.

Double Tap โค๏ธ For More
  • โค 6
Post #2659 1.75K
๐Ÿš€ SQL Project Series #32

SaaS Subscription & Revenue Analytics ๐Ÿ’ป๐Ÿ’ฐ

Analyze subscriptions, plans, payments, upgrades, downgrades, and churn to understand how a SaaS business grows revenue and retains customers.

๐ŸŽฏ Business Objectives

โœ… Analyze subscription growth

โœ… Calculate MRR and ARR

โœ… Track upgrades and downgrades

โœ… Measure customer churn

โœ… Analyze revenue by plan

โœ… Calculate ARPU and CLV

โœ… Identify high-value customers

โœ… Measure monthly revenue growth

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE saas_revenue_db;
USE saas_revenue_db;


๐Ÿ“‚ Step 2: Create Customers Table

CREATE TABLE customers (
customer_id INT PRIMARY KEY,
customer_name VARCHAR(100),
company_name VARCHAR(100),
signup_date DATE,
country VARCHAR(50)
);


๐Ÿ“‚ Step 3: Create Plans Table

CREATE TABLE plans (
plan_id INT PRIMARY KEY,
plan_name VARCHAR(50),
monthly_price DECIMAL(10,2)
);


๐Ÿ“‚ Step 4: Create Subscriptions Table

CREATE TABLE subscriptions (
subscription_id INT PRIMARY KEY,
customer_id INT,
plan_id INT,
start_date DATE,
end_date DATE,
subscription_status VARCHAR(20),
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
FOREIGN KEY (plan_id) REFERENCES plans(plan_id)
);


๐Ÿ“‚ Step 5: Create Subscription Changes Table

CREATE TABLE subscription_changes (
change_id INT PRIMARY KEY,
subscription_id INT,
change_date DATE,
old_plan_id INT,
new_plan_id INT,
change_type VARCHAR(20),
FOREIGN KEY (subscription_id) REFERENCES subscriptions(subscription_id),
FOREIGN KEY (old_plan_id) REFERENCES plans(plan_id),
FOREIGN KEY (new_plan_id) REFERENCES plans(plan_id)
);


๐Ÿ“‚ Step 6: Create Payments Table

CREATE TABLE payments (
payment_id INT PRIMARY KEY,
subscription_id INT,
payment_date DATE,
amount DECIMAL(10,2),
payment_status VARCHAR(20),
FOREIGN KEY (subscription_id) REFERENCES subscriptions(subscription_id)
);


๐Ÿ“‚ Step 7: Insert Sample Customers

INSERT INTO customers VALUES
(1,'Rahul Sharma','DataPro','2025-01-05','India'),
(2,'Priya Verma','TechLabs','2025-01-10','India'),
(3,'Amit Patel','FinTech Solutions','2025-01-15','India'),
(4,'Sneha Joshi','CloudWorks','2025-02-01','India'),
(5,'Rohan Gupta','Analytics Hub','2025-02-10','India');


๐Ÿ“‚ Step 8: Insert Sample Plans

INSERT INTO plans VALUES
(101,'Basic',499),
(102,'Professional',999),
(103,'Business',2499),
(104,'Enterprise',4999);


๐Ÿ“‚ Step 9: Insert Sample Subscriptions

INSERT INTO subscriptions VALUES
(1001,1,102,'2025-01-05',NULL,'Active'),
(1002,2,101,'2025-01-10','2025-04-10','Cancelled'),
(1003,3,104,'2025-01-15',NULL,'Active'),
(1004,4,103,'2025-02-01',NULL,'Active'),
(1005,5,102,'2025-02-10',NULL,'Active');


๐Ÿ“‚ Step 10: Insert Sample Subscription Changes

INSERT INTO subscription_changes VALUES
(1,1001,'2025-03-01',101,102,'Upgrade'),
(2,1004,'2025-04-01',103,104,'Upgrade'),
(3,1005,'2025-05-01',102,101,'Downgrade');


๐Ÿ“‚ Step 11: Insert Sample Payments

INSERT INTO payments VALUES
(501,1001,'2025-02-01',999,'Paid'),
(502,1002,'2025-02-01',499,'Paid'),
(503,1003,'2025-02-01',4999,'Paid'),
(504,1004,'2025-02-01',2499,'Paid'),
(505,1005,'2025-02-01',999,'Paid');
Post #2658 1.81K
๐Ÿš€ ๐—™๐—ฅ๐—˜๐—˜ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ฏ๐˜† ๐—ง๐—ผ๐—ฝ ๐—–๐—ผ๐—บ๐—ฝ๐—ฎ๐—ป๐—ถ๐—ฒ๐˜€๐Ÿ”ฅ

Get FREE access to company-specific interview kits, previous questions, preparation strategies, and important resources! ๐Ÿ‘‡

Google :- https://pdlink.in/4xtUyIG

Amazon :- https://pdlink.in/45Q0YWR

Microsoft :- https://pdlink.in/3Up1bha

Wipro :- https://pdlink.in/4fMo1rA

Infosys :- https://pdlink.in/3TRn8p0

๐Ÿ“Œ share it with friends preparing for placements
  • โค 1
  • ๐Ÿ‘ 1
Post #2657 1.77K
๐ŸŽฏ Key Insights You Can Derive

๐Ÿ”น Which suppliers contribute the most to procurement spending?

๐Ÿ”น Which suppliers frequently deliver late?

๐Ÿ”น Which products have the highest price variance?

๐Ÿ”น Which suppliers offer the most competitive prices?

๐Ÿ”น Which products are purchased most frequently?

๐Ÿ”น Where can procurement costs be reduced?

๐Ÿ”น Which suppliers may represent supply-chain risk? 

This project is especially useful for Data Analysts, Procurement Analysts, Supply Chain Analysts, Operations Analysts, and Business Intelligence professionals.

Double Tap โค๏ธ For More
  • โค 2
Post #2656 1.63K
๐Ÿš€ SQL Project Series #31: Supply Chain & Procurement Analytics ๐Ÿšš

Analyze suppliers, purchase orders, deliveries, procurement costs, and supplier performance using SQL to identify cost-saving opportunities and improve supply chain efficiency.

๐ŸŽฏ Business Objectives

โœ… Analyze purchase orders

โœ… Track supplier performance

โœ… Measure procurement spending

โœ… Identify delayed deliveries

โœ… Analyze purchase costs

โœ… Monitor order fulfillment

โœ… Evaluate supplier quality

โœ… Identify cost-saving opportunities

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE procurement_db;
USE procurement_db;


๐Ÿ“‚ Step 2: Create Suppliers Table

CREATE TABLE suppliers (
supplier_id INT PRIMARY KEY,
supplier_name VARCHAR(100),
city VARCHAR(50),
supplier_category VARCHAR(50)
);


๐Ÿ“‚ Step 3: Create Products Table

CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(100),
category VARCHAR(50),
standard_cost DECIMAL(10,2)
);


๐Ÿ“‚ Step 4: Create Purchase Orders Table

CREATE TABLE purchase_orders (
po_id INT PRIMARY KEY,
supplier_id INT,
po_date DATE,
expected_date DATE,
actual_delivery_date DATE,
po_status VARCHAR(30),
FOREIGN KEY (supplier_id)
REFERENCES suppliers(supplier_id)
);


๐Ÿ“‚ Step 5: Create Purchase Order Items Table

CREATE TABLE purchase_order_items (
po_item_id INT PRIMARY KEY,
po_id INT,
product_id INT,
quantity INT,
unit_cost DECIMAL(10,2),
FOREIGN KEY (po_id)
REFERENCES purchase_orders(po_id),
FOREIGN KEY (product_id)
REFERENCES products(product_id)
);


๐Ÿ“‚ Step 6: Insert Sample Suppliers

INSERT INTO suppliers VALUES
(1,'ABC Suppliers','Mumbai','Electronics'),
(2,'Global Traders','Delhi','Office Supplies'),
(3,'Prime Distributors','Pune','Electronics'),
(4,'Reliable Wholesale','Bangalore','Furniture'),
(5,'Metro Supplies','Hyderabad','General');


๐Ÿ“‚ Step 7: Insert Sample Products

INSERT INTO products VALUES
(101,'Laptop','Electronics',55000),
(102,'Monitor','Electronics',15000),
(103,'Keyboard','Accessories',1200),
(104,'Office Chair','Furniture',6500),
(105,'Printer','Office Equipment',18000);


๐Ÿ“‚ Step 8: Insert Sample Purchase Orders

INSERT INTO purchase_orders VALUES
(1001,1,'2025-01-05','2025-01-10','2025-01-09','Delivered'),
(1002,2,'2025-01-07','2025-01-12','2025-01-15','Delivered'),
(1003,3,'2025-01-10','2025-01-18','2025-01-22','Delayed'),
(1004,4,'2025-01-12','2025-01-20','2025-01-19','Delivered'),
(1005,5,'2025-01-15','2025-01-25',NULL,'Pending');


๐Ÿ“‚ Step 9: Insert Sample Purchase Order Items

INSERT INTO purchase_order_items VALUES
(1,1001,101,20,54000),
(2,1001,102,30,14500),
(3,1002,103,100,1100),
(4,1003,101,15,53500),
(5,1003,105,10,17500),
(6,1004,104,40,6200),
(7,1005,105,20,17200);
  • โค 1
  • ๐Ÿ‘ 1
Post #2655 1.65K
๐Ÿš€ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐——๐—ฎ๐˜๐—ฎ ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿ“Š๐Ÿ”ฅ

Build in-demand Data Analytics skills with Microsoft and strengthen your resume with FREE learning opportunities.

โœ… Beginner-Friendly
โœ… Learn at Your Own Pace
โœ… Build Job-Ready Data Skills
โœ… Improve Your Resume & LinkedIn Profile
โœ… Prepare for Data Analyst & BI Careers

๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4hXL4Ru

๐Ÿ”ฅ Start learning today and take your first step toward a career in Data Analytics & Business Intelligence
Post #2654 2.02K
๐—™๐—ฅ๐—˜๐—˜ ๐——๐—ฎ๐˜๐—ฎ ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐——๐—ฎ๐˜๐—ฎ ๐—ฆ๐—ฐ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿ“Š

Start learning with FREE courses from leading companies and build in-demand skills for 2026.

๐Ÿ”น Data Analytics Essentials โ€” Cisco
๐Ÿ”น Introduction to Data Science โ€” Cisco
๐Ÿ”น Python for Data Science โ€” IBM
๐Ÿ”น Azure Data Fundamentals โ€” Microsoft
๐Ÿ”น Google Analytics โ€” Google

๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/45QpA1I

๐Ÿ”ฅ Start learning today and upgrade your resume with job-ready Data & Analytics skills!
Older posts โ†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’