Posts

Showing posts with the label and u) as both their first and last characters. Your result cannot contain duplicates.

Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last characters. Your result cannot contain duplicates.

Image
  Query the list of   CITY   names from   STATION   which have vowels (i.e.,   a ,   e ,   i ,   o , and   u ) as both their first   and   last characters. Your result cannot contain duplicates. Input Format The  STATION  table is described as follows: SOLUTION : SELECT DISTINCT CITY FROM STATION WHERE LOWER(SUBSTR(CITY , 1,1)) IN('a','e','i','o','u') and  LOWER(SUBSTR(CITY,-1,1)) IN('a','e','i','o','u'); EXPLANATION : SUBSTR(CITY, 1, 1) : Gets the first character. SUBSTR(CITY, -1, 1) : Gets the last character. LOWER(...) : Makes it case-insensitive. IN ('a', 'e', 'i', 'o', 'u') : Checks for vowels. DISTINCT : Removes duplicates.