I'm trying to resolve this exercise:
'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.'
I tried resolving it using the INTERSECT operator like this:
SELECT CITY
FROM STATION
WHERE LEFT(CITY, 1) = 'A' OR LEFT(CITY, 1) = 'O'
OR LEFT(CITY, 1) = 'E' OR LEFT(CITY, 1) = 'I' OR
LEFT (CITY, 1) OR LEFT(CITY, 1) = 'U'
INTERSECT
SELECT CITY
FROM STATION
WHERE RIGHT(CITY, 1) = 'A' OR RIGHT(CITY, 1) = 'O'
OR RIGHT(CITY, 1) = 'E' OR RIGHT(CITY, 1) = 'I' OR
RIGHT (CITY, 1) OR RIGHT(CITY, 1) = 'U';
But I receive the following error message:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTERSECT
SELECT CITY
FROM STATION
WHERE RIGHT(CITY, 1) = 'A' OR RIGHT(CITY, 1)' at line
What am I doing wrong and what other way do I have to solve this exercise?