Help me understand how this works please.
It turns out that I'm starting studies in SQL and
hackerhank has an exercise that needed this code:
SELECT DISTINCT CITY FROM STATION WHERE REGEXP_LIKE(LOWER(CITY), '^[aeiou]') ;
After a lot of effort and someone helped me, as I had gone to a little more than half of this
select and the end in my head I knew what to do, but without technical knowledge it is difficult to write.
Can someone translate what the code is doing so I can assimilate.
FROM STATIONselects data from the
LOWER(CITY)will compare the
CITYcolumn with the lowercase letter;
REGEXP_LIKE(..., '^[aeiou]')compares if they start with vowels;
DISTINCTdoes not show duplicate results;
In other words: Selects all
CITY from the
STATION table, without repetition, that start with vowels in the name;