Skip to content

Commit

Permalink
Create SalesInventoryAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
clairescanlon authored Jan 25, 2024
1 parent 653356f commit f3f30cf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions SalesInventoryAnalysis
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This SQL query is analyzing the date field in the sales data to find the minimum and maximum dates present.


SELECT
MIN(Date) AS min_date,
MAX(Date) AS max_date
FROM
`salesinventoryanalysis-gdac.sales.Sales`

# This SQL query transforms the raw sales data into aggregated metrics that support further analysis and identification of trends.

SELECT
EXTRACT (YEAR FROM date) AS Year,
EXTRACT (MONTH FROM date) AS Month,
ProductID,
ROUND(MAX(UnitPrice),2) AS UnitPrice,
SUM(Quantity) AS UnitsSold
FROM
`salesinventoryanalysis-gdac.sales.Sales`
GROUP BY
Year,
Month,
ProductID
ORDER BY
Year,
Month,
ProductID


0 comments on commit f3f30cf

Please sign in to comment.