I forgot to
ORDER BY grade . The in the video, the
procedure actually returns the student with the lowest grade.
SQLite's case expression (it doesn't have CASE statements) has a slightly different syntax than shown in the video. It looks like this:
UPDATE table_name SET column_name = CASE WHEN cond1 THEN expr1 WHEN cond2 THEN expr2 WHEN cond3 THEN expr3 ELSE expr4 END;