Directly run in sql
1 2 3 4 5 6 7 |
CREATE FUNCTION grade (grade_point INT) RETURNS VARCHAR(15) RETURN CASE WHEN grade_point >= 90 THEN "EXCELLENT" WHEN grade_point >= 80 THEN "GOOD" END |
Then use like
1 |
select grade (79) |