UPDATE paper_questions
SET page_number = CASE question_number
  WHEN '1a' THEN 2
  WHEN '1b' THEN 2
  WHEN '1c' THEN 2
  WHEN '1d' THEN 2
  WHEN '1e' THEN 2
  WHEN '1f' THEN 2
  WHEN '1g' THEN 2
  WHEN '1h' THEN 2
  WHEN '1i' THEN 2
  WHEN '1j' THEN 2
  WHEN '2a_i' THEN 3
  WHEN '2a_ii' THEN 3
  WHEN '2a_iii' THEN 3
  WHEN '2a_iv' THEN 3
  WHEN '2a_v' THEN 4
  WHEN '2a_vi' THEN 4
  WHEN '2a_vii' THEN 4
  WHEN '2b_i' THEN 5
  WHEN '2b_ii' THEN 5
  WHEN '2b_iii' THEN 5
  WHEN '2c' THEN 6
  WHEN '3a_i' THEN 8
  WHEN '3a_ii' THEN 8
  WHEN '3b_i' THEN 9
  WHEN '3b_ii' THEN 9
  WHEN '3b_iii' THEN 10
  WHEN '3c' THEN 10
  WHEN '3d' THEN 11
  WHEN '4a' THEN 12
  WHEN '4b' THEN 13
  WHEN '4c' THEN 13
  WHEN '4d' THEN 13
  WHEN '5a' THEN 14
  WHEN '5b' THEN 14
  WHEN '5c' THEN 14
  WHEN '5d' THEN 15
  WHEN '5e' THEN 15
  WHEN '5f' THEN 15
  WHEN '6a' THEN 16
  WHEN '6b_i' THEN 17
  WHEN '6b_ii' THEN 17
  WHEN '7a' THEN 18
  WHEN '7b' THEN 18
  ELSE page_number
END
WHERE paper_id = (
  SELECT id
  FROM papers
  WHERE source_exam_key = 'COMP2211-2022-fall-midterm'
);
