0
Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.
16 Respuestas
+ 4
SELECT DISTINCT city FROM station WHERE city REGEXP '[aeiou]#x27;;
+ 2
SELECT distinct CITY
from STATION
WHERE lower(substr(city,length(city),length(city))) in('a','e','i','o','u')
+ 1
select distinct(CITY) from STATION where CITY like '%[aeiou]' ;
+ 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 :)
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';
0
select distinct CITY from STATION where CITY not REGEXP'[aeiouAEIOU]#x27;;
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';
0
select distinct city from station where city RLIKE "[aeiou]quot;;
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
0
select distinct city
from station
where city regexp '[aeiouAEIOU]#x27;;
0
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '[AEIOU]#x27;;
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
0
The following solution works fine:
SELECT DISTINCT CITY
FROM STATION
WHERE RIGHT(CITY, 1) IN ('a','e','i','o','u')
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.
- 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';
- 1
SELECT DISTINCT CITY FROM STATION WHERE SUBSTRING(city, -1) IN ("a", "e", "i", "o", "u");