Hello, the question I am referencing is from https://www.chegg.com/homework-help
ID: 3907475 • Letter: H
Question
Hello, the question I am referencing is from https://www.chegg.com/homework-help/questions-and-answers/lab-overview-scenario-summary-lab-6-introduce-concept-group-functions-subqueries-meet-comp-q26629918. Question 5.5. Re-do query 4 but show the customer name for each order (formatted as a single field with heading of Customer)along with the city, order id and total. Filter to only display customers that live in California. Sort by city. this query is using MySQL workbench 8. It returns a column but no total or even null. I can upload the script to create dbase and populate data if you need.
Explanation / Answer
If you have any doubts, please give me comment...
SELECT CONCAT(customer_first_name, ' ',customer_last_name) AS customer_name, customer_city, O.order_id, SUM(order_qty*unit_price) AS total
FROM customers C, orders O, order_details OD, items I
WHERE C.customer_id = O.customer_id AND O.order_id = OD.order_id AND OD.item_id = I.item_id AND C.customer_state = 'California'
GROUP BY customer_first_name, customer_last_name, customer_city, O.order_id
ORDER BY C.customer_city;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.