Alphabetical Addition


  • Letters will always be lowercase.
  • Letters can overflow (see second to last example of the description)
  • If no letters are given, the function should return 'z'


table(letter: ["a", "b", "c"]) = "f"
table(letter: ["a", "b"]) = "c"
table(letter: ["z"]) = "z"
table(letter: ["z", "a"]) = "a"
table(letter: ["y", "c", "b"]) = "d" -- notice the letters overflowing
table(letter: []) = "z"
  1. The SQL CHR function accepts an ASCII code and returns the corresponding character.
  2. The COALESCE function in SQL server is used to return the first Non-NULL value from the list of columns/arguments given in order.
  3. COALESCE is considered similar to writing a CASE statement expression in SQL.
SELECT COALESCE(CHR(CAST((SUM(ascii(letter) - 96)-1)%26 as int)+97), 'z')
as letter
FROM letters;



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store