Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
More Simplified query for this?
SELECT DISTINCT CITY FROM STATION WHERE City LIKE 'a%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'e%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'i%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'o%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'u%';
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You would use regexp:

select distinct city
from station
where city regexp '^[aeiou]';
over 4 years ago · Santiago Trujillo Report

0

You could use OR for this.

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%';
over 4 years ago · Santiago Trujillo Report

0

SQL where clauses can have multiple conditions:

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

Further, since you only care about starts with, you can switch to a substr match:

SELECT DISTINCT city
FROM station
WHERE substr(city,1,1) IN ('a','e','i','o','u');

Although note if city has an index on it this may be less performant (requiring a full table scan)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!