Skip to content

Commit ac310d0

Browse files
authored
Regex operation notation
1 parent c7b0ff9 commit ac310d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

9. REGEX.sql

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
-- REGEXP is a keyword used for pattern matching using regular expressions.
22

3+
4+
-- (^) -> starting with.
5+
-- ($) -> ending with.
6+
37
--'^[aeiou]' is a regular expression pattern that matches city names starting with any lowercase vowel (a, e, i, o, or u).
48
select city from STATION where city regexp('^[AEIOU]');
59

@@ -19,4 +23,4 @@ SELECT CITY FROM STATION WHERE CITY REGEXP '[^aeiou]$';
1923
select city from STATION where city regexp '^[aeiou].*[aeiou]$';
2024

2125
-- not starts and ends with vowel.
22-
select distinct CITY FROM STATION WHERE CITY REGEXP '^[^AEIOU].*[^aeiou]$';
26+
select distinct CITY FROM STATION WHERE CITY REGEXP '^[^AEIOU].*[^aeiou]$';

0 commit comments

Comments
 (0)