This repository contains a comprehensive collection of SQL queries, concepts, and practical implementations developed to strengthen database querying and data analysis skills. The project focuses on real-world business scenarios, including sales analysis, forecasting, error metrics, joins, window functions, and performance optimization.
The primary goal of this project is to demonstrate:
- Strong understanding of SQL fundamentals and advanced concepts
- Ability to work with large datasets
- Practical use of SQL in data analysis and reporting
- Query optimization using indexes and window functions
The database used in this project is sourced from a realistic business dataset and is suitable for analytics-based use cases.
The project uses multiple fact and dimension tables, including but not limited to:
fact_sales_monthlyfact_forecast_monthlyfact_act_estdim_productdim_customer
These tables simulate real-world business operations such as sales transactions, demand forecasting, and customer-product relationships.
- β
Basic SQL Queries (
SELECT,WHERE,ORDER BY) - β
Aggregate Functions (
SUM,COUNT,AVG,ABS) - β
Joins
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- FULL OUTER JOIN (using UNION)
- β Subqueries & Common Table Expressions (CTEs)
- β
Window Functions
OVER()PARTITION BYDENSE_RANK()
- β Grouping & Aggregation
- β
Error Metrics Calculation
- Net Error
- Absolute Error
- Percentage Error
- β Indexing & Performance Optimization
- β Query Debugging and Optimization
- Top N products by division using window functions
- Sales vs Forecast comparison analysis
- Forecast accuracy and error percentage calculation
- Customer and product-level performance analysis
- Handling large datasets efficiently using indexes
- Database: MySQL
- Language: SQL
- Environment: MySQL Workbench
- Version Control: Git & GitHub
- Clone the repository:
git clone https://github.com/Manojsv20/Structured_query_language.git
Import the database into MySQL
Execute the SQL scripts provided
Analyze and modify queries as required
π― Learning Outcomes Gained hands-on experience with complex SQL queries
Improved understanding of data analysis using SQL
Learned query optimization techniques
Applied SQL concepts to real-world datasets
π€ Author Manoj S V B.E β Signal Processing Velammal College of Engineering and Technology
π License This project is intended for learning and educational purposes.