SQL Riddle: Find the Sum of ASCII Codes of Employee Names (solution)
Zahar Hilkevich (from the blog – https://sqlpatterns.wordpress.com – cool blog, you should check it out) posted a riddle on Facebook.
The question was:
“For every employee find the sum of ASCII codes of all the characters in their names. Write a single SELECT statement only.”
EMPNO ENAME SUM_ASCII ----- ---------- ---------- 7788 SCOTT 397 7876 ADAMS 358 7566 JONES 383 7499 ALLEN 364 7521 WARD 302 7934 MILLER 453 7902 FORD 299 7369 SMITH 389 7844 TURNER 480 7698 BLAKE 351 7782 CLARK 365 7654 MARTIN 459 7839 KING 297 7900 JAMES 368