Question: SQL. Apex oracle 2. Create a SQL query that will show the count(*), the sum of the order_total column and the month for each of
SQL. Apex oracle
2. Create a SQL query that will show the count(*), the sum of the order_total column and the month for each of the months in the demo_orders table, group by month so that the user can see the month-to-month order count and total. To get the month, you will have to use the to_char function on the order_timestamp column to extract the month or MON value.
3. Modify the previous query and further break each group from months to months and customer_id. So we want to know what each customer spent each month. ORDER BY the month. This will require you to use the same to_char() code you used to get the month in the GROUP BY clause.
4. Create a SQL query that will show the MIN sum of all the unit_price * quantity in the demo_order_items_table. GROUP BY product_id. So we are looking for the products that generated the lowest overall profit. Dont worry if you cant get the product_id to show in your result set.
5. Modify the previous SQL query to include a column that will show the MAX sum of all the unit_price * quantity in the demo_order_items_table. GROUP BY product_id. So we are looking for the products that generated the greatest overall profit. Dont worry if you cant get the product_id to show in your result set.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
