当一切看起来都很好时,为什么我会收到语法错误。指出了 MySQL 工作台上的错误位置。我检查了很多问题,但没有找到答案。我知道这将是一个小问题,但我无法弄清楚
SELECT * FROM classicmodels.customers;
DELIMITER $$
create function CustomerLevel( credit decimal(10,2))
returns varchar(20) deterministic
begin
declare customerLevel varchar(20);
if (credit > 50000) then set customerLevel = 'PLATINUM';
else if (credit >= 50000 and credit <= 10000) then set customerLevel = 'GOLD';
else IF (credit < 10000) then set customerLevel ='SILVER';
end if;
return (customerLevel);
end; -- this is where the syntax error code is
$$ DELIMITER ;
/*
Error Code: 1064. You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near '' at line 10
*/
```````````````