Question

List the names of the customer (or customers) who spent the greatest dollar amount in a single order.please give me an sql query for this question and i have tables as follows customer(customer_name,a...

List the names of the customer (or customers) who spent the greatest dollar amount in a single order.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

List the names of the customer (or customers) who spent the greatest dollar amount in a single order.

Query:

Select c.customer_name,ord.order_id,max(os.cost*ord.quantity) as "Maximum order cost" from customer c
join orders od on od.customer_id = c.customer_id
join order_details ord on ord.order_id = od.order_id
join office_supplies os on os.item_id = ord.item_id
order by c.customer_name;


Let me know in case if you have any questions. Thanks and All the best.

Add a comment
Know the answer?
Add Answer to:
List the names of the customer (or customers) who spent the greatest dollar amount in a single order.please give me an sql query for this question and i have tables as follows customer(customer_name,a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT