-
Notifications
You must be signed in to change notification settings - Fork 2
/
filter_group.sql
71 lines (59 loc) · 1.05 KB
/
filter_group.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Filter based on numeric values */
select
last_name, department, salary
from
staff
where
salary > 100000;
/* Filter based on character values */
select
last_name, department, salary
from
staff
where
department = 'Tools';
/* Filter based on multiple attributes, all filters must be met*/
select
last_name, department, salary
from
staff
where
department = 'Tools'
and
salary > 100000;
/* Filter based on multiple attributes, at least one filter must be met*/
select
last_name, department, salary
from
staff
where
department = 'Tools'
or
department = 'Books'
/* Filter based on patterns in character strings */
select
department, sum(salary)
from
staff
where
department like 'B%'
group by
department;
/* Filter based on patterns in character strings */
select
department, sum(salary)
from
staff
where
department like 'Bo%'
group by
department;
/* Filter based on patterns in character strings */
select
department, sum(salary)
from
staff
where
department like 'B%y'
group by
department;