From 2eeebff669393c8a31e1139918258b9fe8cd9bdd Mon Sep 17 00:00:00 2001 From: Darci Date: Sun, 27 Oct 2024 22:54:30 -0400 Subject: [PATCH] Partial work --- sql/fashion_magazines.sql | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sql/fashion_magazines.sql b/sql/fashion_magazines.sql index 4dd0555..1de1940 100644 --- a/sql/fashion_magazines.sql +++ b/sql/fashion_magazines.sql @@ -1 +1,14 @@ --- Add your sql here \ No newline at end of file +-- 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 +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 customer_name +ORDER BY customer_name ASC;