{"id":29916598,"url":"https://github.com/vishal-bhandary/sql-data-analytics","last_synced_at":"2025-08-02T05:03:12.176Z","repository":{"id":304984061,"uuid":"1021524388","full_name":"Vishal-bhandary/sql-data-analytics","owner":"Vishal-bhandary","description":"This repository contains a collection of SQL scripts demonstrating various analytical techniques, such as changes over time, cumulative, performance, data segmentation, part-to-whole analysis.","archived":false,"fork":false,"pushed_at":"2025-07-17T14:43:08.000Z","size":6177,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T16:40:59.983Z","etag":null,"topics":["analytics","business-intelligence","customer-segmentation","dashboarding","data-analysis","data-reporting","data-visualization","data-warehouse","etl","kpi","product-analysis","sql","sql-server","star-schema","t-sql"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vishal-bhandary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-17T14:24:41.000Z","updated_at":"2025-07-17T14:43:12.000Z","dependencies_parsed_at":"2025-07-17T20:01:53.582Z","dependency_job_id":"454dc777-36f4-4f82-9296-ecea97b48467","html_url":"https://github.com/Vishal-bhandary/sql-data-analytics","commit_stats":null,"previous_names":["vishal-bhandary/sql-data-analytics"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Vishal-bhandary/sql-data-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishal-bhandary%2Fsql-data-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishal-bhandary%2Fsql-data-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishal-bhandary%2Fsql-data-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishal-bhandary%2Fsql-data-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vishal-bhandary","download_url":"https://codeload.github.com/Vishal-bhandary/sql-data-analytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishal-bhandary%2Fsql-data-analytics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268337936,"owners_count":24234538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","business-intelligence","customer-segmentation","dashboarding","data-analysis","data-reporting","data-visualization","data-warehouse","etl","kpi","product-analysis","sql","sql-server","star-schema","t-sql"],"created_at":"2025-08-02T05:01:10.060Z","updated_at":"2025-08-02T05:03:12.155Z","avatar_url":"https://github.com/Vishal-bhandary.png","language":"TSQL","readme":"# 📊 SQL Data Analytics Project\n\nA hands-on, analytics-driven SQL project built to uncover insights from a modern data warehouse. This project uses advanced T-SQL queries to perform data exploration, segmentation, trend analysis, and KPI generation using dimensional modeling (star schema). It's ideal for showcasing data storytelling and analytical problem-solving skills.\n\n---\n\n## 📚 Table of Contents\n\n* [🔍 Project Overview](#-project-overview)\n* [🎯 Objectives](#-objectives)\n* [🧱 Data Structure](#-data-structure)\n* [📊 Analysis Modules](#-analysis-modules)\n* [📈 Sample Insights](#-sample-insights)\n* [🚀 How to Run](#-how-to-run)\n* [🧰 Tech Stack](#-tech-stack)\n* [🔮 Future Enhancements](#-future-enhancements)\n* [📄 License](#-license)\n\n---\n\n## 🔍 Project Overview\n\nThis project simulates real-world analytics tasks performed over a cleaned and modeled SQL data warehouse. By leveraging structured queries, it enables business users and analysts to perform:\n\n* Customer behavior analysis\n* Product performance reviews\n* Segmentation \u0026 cohort analysis\n* Revenue and trend forecasting\n* KPI dashboard reporting\n\nThe analysis is run on a **star schema** composed of dimension and fact tables in the `gold` layer.\n\n---\n\n## 🎯 Objectives\n\n* Explore and validate database structures and metadata.\n* Generate meaningful business metrics (sales, orders, customers).\n* Perform segment-wise, time-series, and trend analyses.\n* Build reusable analytical views and reports.\n* Leverage SQL window functions for ranking and performance tracking.\n* Enable customer and product segmentation.\n\n---\n\n## 🧱 Data Structure\n\n**Star Schema Overview (Gold Layer):**\n\n* `dim_customers` – Enriched customer demographics and CRM data\n* `dim_products` – Product attributes, categories, cost, and life-cycle\n* `fact_sales` – All transactional order data (sales, quantity, pricing)\n\nAdditional analytical views:\n\n* `report_customers` – Customer-focused KPI summary and segmentation\n* `report_products` – Product performance, ranking, and revenue classification\n\n---\n\n## 📊 Analysis Modules\n\nThe project contains well-documented scripts categorized as follows:\n\n| 🔹 Module                  | 🧠 Purpose                                                                  |\n| -------------------------- | --------------------------------------------------------------------------- |\n| **Database Exploration**   | Understand schema and metadata using `INFORMATION_SCHEMA`                   |\n| **Dimensions Exploration** | Extract unique values (e.g., countries, categories) for analysis            |\n| **Date Range Analysis**    | Understand data availability over time using `MIN()`, `MAX()`, `DATEDIFF()` |\n| **Key Metrics**            | Calculate totals, averages, and counts (e.g., sales, orders, products)      |\n| **Magnitude Analysis**     | Analyze grouped metrics by category, gender, region, etc.                   |\n| **Ranking Analysis**       | Use `TOP`, `RANK()`, `ROW_NUMBER()` to rank top/bottom performers           |\n| **Cumulative Analysis**    | Track running totals and moving averages                                    |\n| **Performance Trends**     | Perform YoY, MoM, and average deviation analysis using `LAG()`              |\n| **Segmentation Analysis**  | Classify customers/products based on business logic                         |\n| **Part-to-Whole Analysis** | Analyze category contribution to total revenue                              |\n| **Customer Report View**   | Full customer profiling: orders, lifetime, recency, segmentation            |\n| **Product Report View**    | Full product performance: quantity, customers, segment, revenue metrics     |\n\n---\n\n## 📈 Sample Insights\n\n\u003e 📌 A few example outputs this project can generate:\n\n* \"Top 10 customers generated 40% of revenue\"\n* \"Products costing over \\$1,000 contribute 60% of total sales\"\n* \"Category ‘Mountain Bikes’ has the highest average monthly revenue\"\n* \"Customer churn can be identified by tracking recency vs lifespan\"\n* \"Segmented customers into `VIP`, `Regular`, and `New` based on behavior\"\n\n---\n\n## 🚀 How to Run\n\n1. Ensure the Gold Layer tables (`dim_customers`, `dim_products`, `fact_sales`) are available and populated.\n2. Run each script independently or as part of an orchestrated SQL job in SSMS.\n3. You may also convert key queries into **SQL views** for reporting or dashboarding purposes.\n4. Use tools like **Power BI**, **Tableau**, or **Excel** to connect to these views for visualization.\n\n---\n\n## 🧰 Tech Stack\n\n* **SQL Server / T-SQL**\n* **Dimensional Modeling (Star Schema)**\n* **Advanced SQL Functions**\n\n  * Window Functions (`RANK()`, `LAG()`, `ROW_NUMBER()`)\n  * Aggregations (`SUM()`, `AVG()`, `COUNT()`)\n  * String, Date, and CASE logic\n\n---\n\n## 🔮 Future Enhancements\n\n* Add parameterized stored procedures for dynamic filtering\n* Build scheduled dashboards using Power BI\n* Include predictive logic using SQL ML Services\n* Introduce real-time metrics using SQL Change Data Capture (CDC)\n\n---\n\n## 📄 License\n\nThis project is released under the [MIT License](LICENSE).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishal-bhandary%2Fsql-data-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishal-bhandary%2Fsql-data-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishal-bhandary%2Fsql-data-analytics/lists"}