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

Feedback #1

Open
wants to merge 7 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-2e0aaae1b6195c2367325f4f02e2d04e9abb55f0b24a779b69b11b9e10269abc.svg)](https://classroom.github.com/online_ide?assignment_repo_id=16795318&assignment_repo_type=AssignmentRepo)
# Fashion Magazines
Code Louisville Data Analysis Exercise

Expand Down
16 changes: 15 additions & 1 deletion sql/fashion_magazines.sql
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
-- Add your sql here
-- returns the customer name and total amount due for
--the customers that have unpaid Fashion Magazine subscriptions.


SELECT
customers.customer_name AS Customer,
--subscriptions.subscription_length*subscriptions.price_per_month AS "Amount Due"
'$' || printf('%.2f', SUM(subscriptions.subscription_length * subscriptions.price_per_month)) AS "Amount Due"
FROM orders
LEFT JOIN customers ON orders.customer_id = customers.customer_id
LEFT JOIN subscriptions ON orders.subscription_id = subscriptions.subscription_id
WHERE orders.order_status = 'unpaid'
AND subscriptions.description = 'Fashion Magazine'
GROUP BY customers.customer_name
ORDER BY customer_name ASC;