DELIMITER //
CREATE FUNCTION show_sign(birthday DATE)
RETURNS VARCHAR(20)
BEGIN
DECLARE sign_name VARCHAR(20);
SET sign_name = CASE
WHEN (MONTH(birthday) = 3 AND DAY(birthday) >= 21) OR (MONTH(birthday) = 4 AND DAY(birthday) <= 19) THEN '白羊座'
WHEN (MONTH(birthday) = 4 AND DAY(birthday) >= 20) OR (MONTH(birthday) = 5 AND DAY(birthday) <= 20) THEN '金牛座'
WHEN (MONTH(birthday) = 5 AND DAY(birthday) >= 21) OR (MONTH(birthday) = 6 AND DAY(birthday) <= 21) THEN '双子座'
WHEN (MONTH(birthday) = 6 AND DAY(birthday) >= 22) OR (MONTH(birthday) = 7 AND DAY(birthday) <= 22) THEN '巨蟹座'
WHEN (MONTH(birthday) = 7 AND DAY(birthday) >= 23) OR (MONTH(birthday) = 8 AND DAY(birthday) <= 22) THEN '狮子座'
WHEN (MONTH(birthday) = 8 AND DAY(birthday) >= 23) OR (MONTH(birthday) = 9 AND DAY(birthday) <= 22) THEN '处女座'
WHEN (MONTH(birthday) = 9 AND DAY(birthday) >= 23) OR (MONTH(birthday) = 10 AND DAY(birthday) <= 23) THEN '天秤座'
WHEN (MONTH(birthday) = 10 AND DAY(birthday) >= 24) OR (MONTH(birthday) = 11 AND DAY(birthday) <= 22) THEN '天蝎座'
WHEN (MONTH(birthday) = 11 AND DAY(birthday) >= 23) OR (MONTH(birthday) = 12 AND DAY(birthday) <= 21) THEN '射手座'
WHEN (MONTH(birthday) = 12 AND DAY(birthday) >= 22) OR (MONTH(birthday) = 1 AND DAY(birthday) <= 19) THEN '摩羯座'
WHEN (MONTH(birthday) = 1 AND DAY(birthday) >= 20) OR (MONTH(birthday) = 2 AND DAY(birthday) <= 18) THEN '水瓶座'
ELSE '双鱼座'
END;
RETURN sign_name;
END//
DELIMITER ;