Skip to content

Instantly share code, notes, and snippets.

@alivx
Last active January 17, 2024 17:15
Show Gist options
  • Save alivx/6705be7ded43c62f8d51f2c582a2bd2b to your computer and use it in GitHub Desktop.
Save alivx/6705be7ded43c62f8d51f2c582a2bd2b to your computer and use it in GitHub Desktop.
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
Start with
select DISTINCT CITY from STATION where CITY rlike '^[a,e,i,o,u]';
End with
select DISTINCT CITY from STATION where CITY rlike '[a,e,i,o,u]$';
Both Start and end
select DISTINCT CITY from STATION where CITY rlike '^[a,e,i,o,u].*[a,e,i,o,u]$';
SELECT DISTINCT CITY from STATION where CITY REGEXP '^[^aeiou].*[^aeiou]$';
@Bharatgaur
Copy link

SELECT DISTINCT CITY
FROM STATION
WHERE CITY NOT REGEXP '^[aeiouAEIOU]';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment