Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

19th Dec 2016, 9:56 AM
Akwin Lopez
Akwin Lopez - avatar
16 Answers
+ 4
SELECT DISTINCT city FROM station WHERE city REGEXP '[aeiou]
#x27;;
7th Oct 2019, 12:42 PM
Flaviu Pop
Flaviu Pop - avatar
+ 2
SELECT distinct CITY from STATION WHERE lower(substr(city,length(city),length(city))) in('a','e','i','o','u')
8th Aug 2019, 6:47 AM
Harshvardhan Singh Gaharwar
Harshvardhan Singh Gaharwar - avatar
+ 1
select distinct(CITY) from STATION where CITY like '%[aeiou]' ;
14th Jun 2019, 10:34 AM
ja ja
+ 1
SELECT CITY FROM STATION WHERE RIGHT(CITY,1) IN ('a', 'e', 'i', 'o', 'u') Example : If you want to 3. character ; SELECT CITY FROM STATION WHERE RIGHT(LEFT(CITY,3),1) IN ('a', 'e', 'i', 'o', 'u') you can get what you want by changing this script :)
10th Oct 2019, 12:44 PM
Abdurrahman Karataş
Abdurrahman Karataş - avatar
0
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';
19th Dec 2016, 9:56 AM
Akwin Lopez
Akwin Lopez - avatar
0
select distinct CITY from STATION where CITY not REGEXP'[aeiouAEIOU]
#x27;;
27th Jun 2017, 1:50 PM
ADITYA PRAKASH
ADITYA PRAKASH - avatar
0
For MySQL as well as Oracle: If we want to print the city name which starts with vowels(a,e,i,o,u) then we can use the query which is given below...... SQL>select city from STATION where city LIKE 'a/A %' OR city LIKE 'e/E %' OR city LIKE 'i/I %' OR city LIKE 'o/O %' OR city LIKE 'u/U %'; Here we can write either lowercase or uppercase letter and we can get our desired output. And If we want to print the city name which ends with vowels(a,e,i,o,u) then we can use the query which is given below...... SQL>select distinct city from STATION where city LIKE '% a/A' OR city LIKE '% e/E' OR city LIKE '% i/I' OR city LIKE '% o/O' OR city LIKE '% u/U';
26th May 2020, 5:47 AM
Shashank Pathak
0
select distinct city from station where city RLIKE "[aeiou]
quot;;
5th Jun 2020, 7:01 PM
Abdallah Rawashdeh
Abdallah Rawashdeh - avatar
0
try with MySQL solution : select distinct CITY from STATION where substr(CITY, -1, 1) in ('a','e','i','o','u'); Here "distinct" will solve the problem of duplicate value and "substring" function extract substring from string . Substring also contain start & length . For more details follow the link :- https://www.w3schools.com/sql/func_mysql_substr.asp
17th Jul 2020, 9:42 AM
anusuya roy
anusuya roy - avatar
0
select distinct city from station where city regexp '[aeiouAEIOU]
#x27;;
3rd Nov 2020, 4:47 AM
Niti R
Niti R - avatar
0
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '[AEIOU]
#x27;;
19th Jan 2021, 7:33 AM
Rajat Goel
Rajat Goel - avatar
0
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' ; you have to write the vowels in lower case because there is no any word ending in upper case
22nd Jan 2021, 3:21 PM
yara qenawi
yara qenawi - avatar
0
The following solution works fine: SELECT DISTINCT CITY FROM STATION WHERE RIGHT(CITY, 1) IN ('a','e','i','o','u')
15th Dec 2021, 2:28 PM
Reinaldo Henrique
Reinaldo Henrique - avatar
0
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'; 1)In my Sql we use '_%' wild card operator to get output ending with the character you want.
9th Aug 2022, 5:41 PM
Bhuvanagiri Revanth
Bhuvanagiri Revanth - avatar
- 1
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';
13th Apr 2018, 8:58 AM
Kagithapu Vasanthi
Kagithapu Vasanthi - avatar
- 1
SELECT DISTINCT CITY FROM STATION WHERE SUBSTRING(city, -1) IN ("a", "e", "i", "o", "u");
3rd Sep 2018, 10:42 AM
Edik Horyach
Edik Horyach - avatar