Table: ryukyu_edo_missions
Columns: year
mission_type
shogun
ry_ky_an_king
lead_envoy
number_in_entourage

Question: What is the latest year of a gratitude type mission with 99 in the entourage?
SQL: SELECT MAX("year") FROM ryukyu_edo_missions WHERE "number_in_entourage" = '99' AND "mission_type" = 'gratitude'

Question: Who was the lead envoy of the mission with the Ryūkyūan King shō eki?
SQL: SELECT "lead_envoy" FROM ryukyu_edo_missions WHERE "ry_ky_an_king" = 'shō eki'

Question: Who was the lead envoy of the congratulation mission in 1718 with the Ryūkyūan King shō kei?
SQL: SELECT "lead_envoy" FROM ryukyu_edo_missions WHERE "ry_ky_an_king" = 'shō kei' AND "mission_type" = 'congratulation' AND "year" = 1718

Question: Who was the lead envoy with the Ryūkyūan King shō kō?
SQL: SELECT "lead_envoy" FROM ryukyu_edo_missions WHERE "ry_ky_an_king" = 'shō kō'