Search code examples
sqlwhere-clausesql-like

Multiple letters in one word in SQL


I recently have started learning SQL however I have came across a problem I can't solve. The question I am being asked is "Find the countries that have three or more a in the name" meaning I need to find countries with 3 or more (a)'s in them. How do I go about entering this into my search.

I am pretty sure it will start with something like this (what I have below) but I am not sure what to add in after like. My tables name is called name.

WHERE name LIKE

Bahamas will be one of my outputted answers, but what do I need to enter to get that?


Solution

  • Simple but working fine :)

    WHERE name like '%a%a%a%'