The code for CustomerLevel_Fuction.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 >= 15000) THEN SET customerLevel = 'GOLD'; ELSEIF credit < 15000 AND credit > 0 THEN SET customerLevel = 'SILVER'; ELSE SET customerLevel = 'LEAD'; END IF; -- return the customer level RETURN (customerLevel); END$$ DELIMITER ;