SQL Query

Question

Query the list of CITY names from STATION that does not start with vowels and do not end with vowels. Your result cannot contain duplicates.

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

in progress 1
Nitin 55 years 1 Answer 3323 views Newbie 0

Answer ( 1 )

  1. SELECT DISTINCT CITY FROM STATION WHERE LOWER(SUBSTR(CITY,1,1)) NOT IN (‘a’,’e’,’i’,’o’,’u’) AND LOWER(SUBSTR(CITY,LENGTH(CITY),1)) NOT IN (‘a’,’e’,’i’,’o’,’u’);

  2. SELECT DISTINCT CITY
    FROM STATION
    WHERE CITY regexp ‘^[^aeiou]’ and CITY regexp ‘[^aeiou]$’;

Leave an answer

Browse
Browse