Toy 3

PHOTO EMBED

Sat Jul 29 2023 01:33:36 GMT+0000 (Coordinated Universal Time)

Saved by @kentrickfelix #mysql

SELECT temp.customerNumber, country, AVG(timeShipped) AS avgTimeShipped
FROM (
	SELECT customerNumber, shippedDate - orderDate AS timeShipped
	FROM orders
) AS temp
JOIN customers c ON temp.customerNumber = c.customerNumber
GROUP BY customerNumber
ORDER BY country, avgTimeShipped DESC;
content_copyCOPY