From 9ac3cbbbc01ea35dacd58b794cdf9a7d344872ac Mon Sep 17 00:00:00 2001 From: Anikait <50035624+anikait1@users.noreply.github.com> Date: Sun, 19 Sep 2021 16:12:50 +0530 Subject: [PATCH 1/2] Update step4.md Added the where clause to 3rd question to filter out BTC transactions as stated by the question. --- course-content/step4.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/course-content/step4.md b/course-content/step4.md index 977bd5c..dce3fb0 100644 --- a/course-content/step4.md +++ b/course-content/step4.md @@ -126,6 +126,7 @@ SELECT ROUND(SUM(quantity)::NUMERIC, 2) AS total_quantity, ROUND(AVG(quantity)::NUMERIC, 2) AS average_quantity FROM trading.transactions +WHERE ticker = 'BTC' GROUP BY txn_year, txn_type ORDER BY txn_year, txn_type; ``` @@ -502,4 +503,4 @@ ORDER BY sold_eth_quantity DESC; | c9f0f8 | 2020-11-01 | 15.931855129247867 | [![forthebadge](./../images/badges/go-to-previous-tutorial.svg)](https://github.com/datawithdanny/sql-masterclass/tree/main/course-content/step3.md) -[![forthebadge](./../images/badges/go-to-next-tutorial.svg)](https://github.com/datawithdanny/sql-masterclass/tree/main/course-content/step5.md) \ No newline at end of file +[![forthebadge](./../images/badges/go-to-next-tutorial.svg)](https://github.com/datawithdanny/sql-masterclass/tree/main/course-content/step5.md) From 6b23c7ce2a2c67fc28deec857a191e743ad3faa3 Mon Sep 17 00:00:00 2001 From: Anikait <50035624+anikait1@users.noreply.github.com> Date: Sun, 19 Sep 2021 16:22:13 +0530 Subject: [PATCH 2/2] Update step4.md Add where clause to question 4 --- course-content/step4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course-content/step4.md b/course-content/step4.md index dce3fb0..af68780 100644 --- a/course-content/step4.md +++ b/course-content/step4.md @@ -162,7 +162,7 @@ SELECT SUM(CASE WHEN txn_type = 'BUY' THEN quantity ELSE 0 END) AS buy_quantity, SUM(CASE WHEN txn_type = 'SELL' THEN quantity ELSE 0 END) AS sell_quantity FROM trading.transactions -WHERE txn_date BETWEEN '2020-01-01' AND '2020-12-31' +WHERE txn_date BETWEEN '2020-01-01' AND '2020-12-31' AND ticker = 'ETH' GROUP BY calendar_month ORDER BY calendar_month; ```