user2609410
user2609410

Reputation: 319

Mysql like operator

Query the list of CITY names from STATION which have vowels as both their first and last characters. Your result cannot contain duplicates. Station consists of a column called city.

Query:

SELECT CITY FROM STATION WHERE CITY LIKE '[AEIOU]%[AEIOU]';

How is this wrong? It produces no output.

Upvotes: 4

Views: 572

Answers (1)

Elixir Techne
Elixir Techne

Reputation: 1856

You have to use REGEXP.

Your code should be like

SELECT CITY FROM STATION WHERE CITY REGEXP '^[AEIOU].*[AEIOU]$';

Upvotes: 3

Related Questions