'Show the name and capital where the name and the capital have the same number of characters

Greece has capital Athens. Each of the strings 'Greece', and 'Athens' has 6 characters.

My code:

     SELECT name, capital
     FROM world
     WHERE len(name) = len(capital)

This gives me the name of countries having the same length as their capitals but the website I am practicing SQL with does not approve it. What do you think?

sql


Solution 1:[1]

I believe you need to use:

LENGTH(name) = LENGTH(capital)

I do not think "len" works.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Trippingbillies41