SQL Query starting with vowels using REGEX

SQL Query starting with vowels using REGEX

Instructor-svgAl-Mamun Sarkar
Mar 27 , 2020

Write a SQL query to get all cities starting with vowels from the STATION table. This is the solution of HackerRank's Weather Observation Station 6 SQL problem.

Table name: STATION

Table Structure:

Fileds Type
ID NUMBER
CITY VARCHAR
STATE VARCHAR
LAT_N NUMBER
LONG_W NUMBER

 

SQL Query:

SELECT DISTINCT city
FROM station
WHERE city REGEXP "^[aeiou].*";

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram