sql - Select rows where the string in one column is an extension of a string in another column -


the question: find capital , name capital extension of name of country. note capital must longer name (mexico-city compared luxembourg) work, it's incorrect

select name , capital world capital concat(name, '%') 

to extension can use replace function in following query replacing 'name' of country 'capital' null.

select name , replace(capital,name,'') world capital concat(name, '_%'); 

Comments