Analyze monthly revenue and order volume trends using SQL aggregations on an online sales dataset.
- 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
- task6_sales_trend.sql: SQL script with all steps
- Orders.csv, Details.csv: Sample datasets
- screenshots/: screenshots of query results
- README.md: This documentation
- 📅 Date Conversion Converted Order_Date from DD-MM-YYYY to YYYY-MM-DD using string manipulation for compatibility with strftime().
- 📆 Monthly & Yearly Grouping Used strftime('%Y') and strftime('%m') to extract year and month from formatted dates.
- 💰 Monthly Revenue Joined Orders and Details tables on Order_ID, then used SUM(Sales) to calculate monthly revenue.
- 📦 Monthly Order Volume Grouped orders by month and year, using COUNT(DISTINCT Order_ID) to get unique order volume.
- 📈 Combined Revenue & Volume Merged revenue and volume metrics by month/year to analyze trends and sort results chronologically.
- ⏳ Time Filtering Applied filters to limit results to specific time periods for focused analysis.
- 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