Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates. Input Format The STATION table is described as follows:

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';       
Comment

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

SELECT DISTINCT CITY
FROM STATION 
WHERE REGEXP_LIKE(CITY, '^[aeiouAEIOU]')
ORDER BY CITY
Comment

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

SELECT DISTINCT city FROM station WHERE city RLIKE '[aeiouAEIOU]$';
Comment

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

SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[^aeiou].*[^aeiou]$';
Comment

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.

SELECT DISTINCT CITY
FROM STATION 
WHERE REGEXP_LIKE(CITY, '^[aeiouAEIOU]')
    AND REGEXP_LIKE(CITY, '[aeiouAEIOU]$');
Comment

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.

SELECT DISTINCT(CITY) 
    FROM STATION
    WHERE (LOWER(CITY) LIKE 'a%'
    OR LOWER(CITY) LIKE 'e%'
    OR LOWER(CITY) LIKE 'i%'
    OR LOWER(CITY) LIKE 'o%'
    OR LOWER(CITY) LIKE 'u%')
    AND (CITY LIKE '%a'
    OR CITY LIKE '%e'
    OR CITY LIKE '%i'
    OR CITY LIKE '%o'
    OR CITY LIKE '%u')
Comment

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

SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[aeiou]';
Comment

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

select distinct city from station where city substr(city,1,1) in ('a','e','i','o','u');
Comment

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

SELECT DISTINCT 
CITY 
FROM STATION 
WHERE lower(substr(CITY,1,1)) in ('a','e','i','o','u') ;
Comment

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

SELECT DISTINCT city FROM station 
GROUP BY city HAVING LEFT(city, 1) IN ("a", "e", "i", "o", "u");
Comment

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

select distinct city from station where city not regexp '^[aeiou]' or city not regexp '[aeiou]$';
Comment

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

SELECT DISTINCT city FROM station WHERE city RLIKE '^[aeiou]';
Comment

PREVIOUS NEXT
Code Example
Sql :: sql server get type of column 
Sql :: delete top 100 rows in sql server 
Sql :: moodle query first user access 
Sql :: Are NULL values in a database the same as that of blank space or zero? 
Sql :: integer limit sql create table 
Sql :: mysql current user 
Sql :: $query = mysqli_query($con, $sql); while ($row = mysqli_fetch_array($query)) 
Sql :: oracle apex who is connected 
Sql :: mysql case when null 
Sql :: how to get the ddl for datafile in oracle tablespace 
Sql :: create another table from existing table sql oracle 
Sql :: remove spaces sql server 
Sql :: add created and updatedAt fields in mysql 
Sql :: mysql get age from date 
Sql :: postgresql CREATE EXTENSION pgcrypto 
Sql :: reset sql auto increment 
Sql :: oracle character set 
Sql :: go install mysql 
Sql :: alter table add column 
Sql :: return insert results in POSTGRESQL 
Sql :: add user mysql wordpress 
Sql :: sql last 3 rows 
Sql :: postgres concat_ws 
Sql :: org.h2.jdbc.jdbcsqlsyntaxerrorexception table not found 
Sql :: sql server: select column values as comma separated string 
Sql :: sql select data from last week 
Sql :: create function in postgresql 
Sql :: MYSQL HOT TO COUNT THE DURATION BETWEEN TWO DATES 
Sql :: enable service broker in sql server 
Sql :: select all except one column sql 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =