DELIMITER // CREATE PROCEDURE Get_country_payments(IN p_year INT, IN p_country VARCHAR(50)) BEGIN SELECT YEAR(p.paymentDate) AS payment_year, c.country, CONCAT(FORMAT(SUM(p.amount) / 1000, 0), 'K') AS total_amount FROM payments p JOIN customers c ON p.customerNumber = c.customerNumber WHERE YEAR(p.paymentDate) = p_year AND c.country = p_country GROUP BY payment_year, c.country; END; end // CALL Get_country_payments(2002, 'USA');