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 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 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 :: oracle sql create table from select 
Sql :: mysql set password for user 
Sql :: date to string mariadb 
Sql :: convert money to varchar sql server 
Sql :: SQL Server rename foreign key constraint 
Sql :: add column if not exists mysql 
Sql :: sql trim whitespace 
Sql :: mariadb alter table add column if not exists example 
Sql :: rename database in sql 
Sql :: select count 
Sql :: order by desc postgres 
Sql :: count column of tables psql 
Sql :: how to extract year from date in sql 
Sql :: phpmyadmin change password 
Sql :: nested if in mysql 
Sql :: sql get the name of user pc 
Sql :: sql select into statement 
Sql :: mysql dump specific tables 
Sql :: mysql disable query caching 
Sql :: import all databases mysql 
Sql :: xampp import sql file command line 
Sql :: update with select postgresql 
Sql :: sql all columns 
Sql :: in mysql workbench contnent not feching 
Sql :: oracle sql drop column if exists 
Sql :: docker create postgresql database 
Sql :: mysql get last inserted id 
Sql :: check database size in gb mysql 
Sql :: postgresql get connection string 
Sql :: how to check table name in current database sql 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =