From 684d9824e607b94b140b922022dcbb2d0f6b50c9 Mon Sep 17 00:00:00 2001 From: reddangerous <dkinyanjui144@gmail.com> Date: Sat, 1 Apr 2023 12:19:31 +0300 Subject: [PATCH] Updated Activity15.sql creation of Function and calling the function to determine the average --- Lesson08/Activity15/Activity15.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lesson08/Activity15/Activity15.sql b/Lesson08/Activity15/Activity15.sql index 70c9ed6..b307f8e 100644 --- a/Lesson08/Activity15/Activity15.sql +++ b/Lesson08/Activity15/Activity15.sql @@ -14,9 +14,9 @@ sqlda$# SELECT AVG(sales_amount) FROM sales INTO sales_avg WHERE sales_transacti -- Return the function variable, end the function and specify the language sqlda$# RETURN sales_avg; -sqlda$# END; $channel_avg$ +sqlda$# END; $sales_avg$ sqlda-# LANGUAGE PLPGSQL; -- Use the function to determine the average sales value since 2013-04-12 -sqlda=# SELECT avg_sales_since('2013-04-12', '2014-04-12'); +sqlda=# SELECT avg_sales_window('2013-04-12', '2014-04-12');