Skip to content
Advertisement

Comparing substrings in two columns across tables in sqlite

I’m using Python and trying to compare two tables in SQL and match them by partial country names. So far I’ve gotten country names that match exactly. I’m running into an issue trying to get partial matches. One example that I’m trying to get a match for is ‘Burma’ in one table and ‘Burma (Myanmar)’ in another table.

This is my result:

Advertisement

Answer

Concatenate the % wildcard to use with the operator LIKE and change the WHERE clause to ON clause because you are joining the tables:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement