http://sqlzoo.net/wiki/SELECT_from_WORLD_Tutorial#All_the_vowels
Equatorial Guinea and Dominican Republic have all of the vowels (a e i o u) in the name. They don't count because they have more than one word in the name.
Find the country that has all the vowels and no spaces in its name. You can use the phrase name NOT LIKE '%a%' to exclude characters from your results.
The query shown misses countries like Bahamas and Belarus because they contain at least one 'a'
I thought I could do this with more of a brute force method of nesting many OR statements but that didn't work and I'm not sure how to exclude a space from showing up.
How to exclude the space
AND NOT LIKE '% %'
You want all of the vowels in the word, so you need to use AND
, not OR
.
Also, to exclude something from the reply, you can use NOT LIKE
. This exclusion condition counts in addition to all the vowel-conditions, so it too needs to be linked with AND.
If you can't solve it yourself, move your cursor over this block to see a valid solution:
SELECT name
FROM world
WHERE name LIKE '%A%'
AND name LIKE '%E%'
AND name LIKE '%I%'
AND name LIKE '%O%'
AND name LIKE '%U%'
AND name LIKE '%a%'
AND name LIKE '%e%'
AND name LIKE '%i%'
AND name LIKE '%o%'
AND name LIKE '%u%'
AND name NOT LIKE '% %'
(check this answer's sourcecode for a properly formatted solution)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With