-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathregular_expression.sql
53 lines (44 loc) · 1.08 KB
/
regular_expression.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Select list of unique job titles */
select distinct
job_title
from
staff;
/* Select lis of job titles that begin wiht Assistant */
select distinct
job_title
from
staff
where
job_title like 'Assistant%';
/* Select a list of job titles that include Assistant I, II or III but not IV*/
/* | is the regular expression OR operator */
select distinct
job_title
from
staff
where
job_title similar to '%Assistant%(I)*';
/* Select a list of job titles that include Assistant II or IV*/
/* | is the regular expression OR operator */
select distinct
job_title
from
staff
where
job_title similar to '%Assistant%(II|IV)';
/* Select a list of job titles that include Assistant II, IV or any other 2 character starting with I */
/* | is the regular expression OR operator */
select distinct
job_title
from
staff
where
job_title similar to '%Assistant I_';
/* Select a list of job titles that begin with E, P, or S */
/* |[] are used to list characters that can match */
select distinct
job_title
from
staff
where
job_title similar to '[EPS]%';