Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Activity15.sql creation of Function and calling the function … #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lesson08/Activity15/Activity15.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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');