Today I learned how to get the filename from a path using SQLite core functions....

@alex@social.alexschroeder.ch

Today I learned how to get the filename from a path using SQLite core functions. I didn't think it was possible but Stackoverflow had the answer:

select replace(str, rtrim(str, replace(str, '/', '')), '') from table;

Given a str of a/b/c, the innermost replace results in abc (everything except the slash), the rtrim then removes everything except the slash from the right, resulting in a/b/ and the outermost replace then replaces a/b/ in a/b/c with the empty string, resulting in c. Hurray!