Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am using livesql.oracle This is CTE I created for problem 4 SELECT CUST_LAST_NAME, CUST_EMAIL, ORDER_ID, SUM(QUANTITY) AS QTY FROM (SELECT CUST_LAST_NAME, CUST_EMAIL, ORDERS.ORDER_ID, PRODUCT_ID,

I am using livesql.oracle

This is CTE I created for problem 4

SELECT CUST_LAST_NAME, CUST_EMAIL, ORDER_ID, SUM(QUANTITY) AS QTY FROM (SELECT CUST_LAST_NAME, CUST_EMAIL, ORDERS.ORDER_ID, PRODUCT_ID, QUANTITY FROM OE.CUSTOMERS INNER JOIN OE.ORDERS ON OE.CUSTOMERS.CUSTOMER_ID = OE.ORDERS.CUSTOMER_ID INNER JOIN OE.ORDER_ITEMS ON OE.ORDERS.ORDER_ID = OE.ORDER_ITEMS.ORDER_ID ORDER BY ORDER_ID ASC) CTE GROUP BY CUST_LAST_NAME, CUST_EMAIL, ORDER_ID;

5. Using the CTE named customer_information that you created for the previous problem (problem 4). Add a correlated subquery that also shows the total value of the order. Using an alias, name this calculated field OrderTotal. Because this is a corelated subquery, it falls into the category of an aggregate and does not need to be included in the GROUP BY clause. (Hint: You will have to correlate between oe.orderse.order_id and customer_information.orderid to get order_total).

This link contains all field https://livesql.oracle.com/apex/livesql/s/hzkq0rjxsapmmnmh1aeid4iey

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions