diff --git a/course-content/step4.md b/course-content/step4.md index 977bd5c..af68780 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; ``` @@ -161,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; ``` @@ -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)