-2

The question is to 'query the list of CITY names from STATION that either do not start with vowels or do not end with vowels.' But the not here should work as "and" instead of "or"?

2 Answers2

2

The problem is stated as "NOT(starting with a vowel) OR NOT(ending with a vowel)". The sql expression is saying "NOT(starting with a vowel AND ending with a vowel)", which is equivalent: https://en.wikipedia.org/wiki/De_Morgan%27s_laws

...except that the sql expression will produce the wrong result for city names that are just a single vowel character, because the regex will only match values when there are at least two characters.

ysth
  • 96,171
  • 6
  • 121
  • 214
1

You regex should be (^[aeiou])|([aeiou]$) Right now regex will only match if it start and ends with a vowel, while you want to say, start with vowel and it doesn't matter what is after, or it doesn't matter what is at the begining as long as it ends with a vowel.