Posts

Showing posts with the label e

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.

Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.

Image
Query the list of   CITY   names starting with vowels (i.e.,   a ,   e ,   i ,   o , or   u ) from   STATION . Your result   cannot   contain duplicates. Input Format The  STATION  table is described as follows: SOLUTION :  SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'A%'     OR CITY LIKE 'E%'     OR CITY LIKE 'I%'     OR CITY LIKE 'O%'     OR CITY LIKE 'U%'; EXPLANATION :  DISTINCT : Ensures no duplicate city names are returned. SUBSTR(CITY, 1, 1) : Gets the first character of the city name. LOWER(...) : Converts the first character to lowercase for a case-insensitive comparison. IN ('a', 'e', 'i', 'o', 'u') : Filters cities that start with a vowel.