The code for CustomerLevel_Func.sql is: DROP FUNCTION IF EXISTS CustomerLevel; DELIMITER $$ CREATE FUNCTION CustomerLevel( credit DECIMAL(10,2) ) RETURNS VARCHAR(20) DETERMINISTIC BEGIN DECLARE customerLevel VARCHAR(20); IF credit > 50000 THEN SET customerLevel = 'PLATINUM'; ELSEIF (credit <= 50000 AND credit >= 10000) THEN SET customerLevel = 'GOLD'; ELSEIF credit < 10000 THEN SET customerLevel = 'SILVER'; END IF; -- return the customer level RETURN (customerLevel); END$$ DELIMITER ; SHOW FUNCTION STATUS WHERE db = 'classicmodels'; SELECT CustomerLevel(5000); SELECT CustomerLevel(15000); SELECT CustomerLevel(50001); SELECT customerName, CustomerLevel(creditLimit) FROM customers ORDER BY customerName;