-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
653356f
commit f3f30cf
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|