Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 2.57 KB

File metadata and controls

53 lines (42 loc) · 2.57 KB

📊 Task 6: Sales Trend Analysis Using Aggregations (ELEVATE LABBS INTERNSHIP)

🧠 Objective

Analyze monthly revenue and order volume trends using SQL aggregations on an online sales dataset.

🛠️ Tools Used

  • SQLite (via strftime() for date extraction and formatting)
  • SQL for data manipulation and aggregation
  • Dataset:
  • Orders.csv: Contains Order_ID, Order_Date (in DD-MM-YYYY format)
  • Details.csv: Contains Order_ID, Sales

📁 Files Included

  • task6_sales_trend.sql: SQL script with all steps
  • Orders.csv, Details.csv: Sample datasets
  • screenshots/: screenshots of query results
  • README.md: This documentation

📌 Key Steps & Logic

  1. 📅 Date Conversion Converted Order_Date from DD-MM-YYYY to YYYY-MM-DD using string manipulation for compatibility with strftime().
Taks 6 A
  1. 📆 Monthly & Yearly Grouping Used strftime('%Y') and strftime('%m') to extract year and month from formatted dates.
Task 6 B
  1. 💰 Monthly Revenue Joined Orders and Details tables on Order_ID, then used SUM(Sales) to calculate monthly revenue.
Task 6 C
  1. 📦 Monthly Order Volume Grouped orders by month and year, using COUNT(DISTINCT Order_ID) to get unique order volume.
Task 6 D
  1. 📈 Combined Revenue & Volume Merged revenue and volume metrics by month/year to analyze trends and sort results chronologically.
Task 6 E
  1. ⏳ Time Filtering Applied filters to limit results to specific time periods for focused analysis.
Task 6 F

❓ Interview Prep Highlights

  • Difference between COUNT(*) vs COUNT(DISTINCT col)
  • Handling NULL values in aggregates
  • Role of GROUP BY vs ORDER BY
  • Extracting top 3 months by revenue using ORDER BY SUM(Sales) DESC LIMIT 3

##✅ Outcome

  • Learned how to group data by time dimensions
  • Practiced SQL joins, aggregations, and filtering
  • Built a reusable script for sales trend analysis