SELECT `product_id`, `product_name`, `total_sales_amount`, `total_sales_quantity` FROM (SELECT p.`product_id`, `product_name`, sum(`sales_amount`) AS `total_sales_amount`, sum(`sales_quantity`) AS `total_sales_quantity`, RANK() OVER(ORDER BY sum(`sales_quantity`) DESC) AS `rank` FROM sales_records s...