Considering this line in your question: "each with a link to a thumbnails in .jpg format. "
You may also try a regexp
: ending with .jpg
SELECT DISTINCT url_column as regex_u, id
FROM your_table
where url_column regexp '\(.jpg)$';
even with like
: contains
jpg
SELECT DISTINCT url_column as like_u, id
FROM your_table
where url_column like '%.jpg%';
Another with instr:
SELECT DISTINCT url_column as instr_u , id
FROM your_table
where instr(url_column, '.jpg') > 0;
If you want to match a whole ulr
SELECT DISTINCT url_column as url_u, id
FROM your_table
where url_column regexp '^(https?://|www\\.)[\.A-Za-z0-9/_\-]+\\.(jpg)$'
;
Another using Right
:
SELECT DISTINCT url_column as right_u, id
FROM your_table
where Right(url_column,4) = '.jpg';
Please check the explain plan
for the most efficient solution. LIKE
seems to take the longest.