I have a postgres db with a table named data. as an example this table contains 6 entires where 3 are erroneous:
data
-----------------
foo/bar/file1.txt
foo/bar/file2.txt
file3.txt
foo/bar/file4.txt
file5.txt
file6.txt
I am looking for a way to strip the 3 files with extra path such that the output becomes:
data
-----------------
file1.txt
file2.txt
file3.txt
file4.txt
file5.txt
file6.txt
SUBSTRING(file_name, 50,70)
I can select the right result, but I cant exactly figure out how I rename them in my table: SELECT substring(data, 9, 100) FROM db WHERE data LIKE 'foo/bar%';