-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL_querying_2_where_statement.sql
More file actions
61 lines (42 loc) · 1.06 KB
/
SQL_querying_2_where_statement.sql
File metadata and controls
61 lines (42 loc) · 1.06 KB
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
#### #### This script is for use with the Parks_and_Rec database created with: MySQL-YouTube-Series/Beginner - Parks_and_Rec_Create_db.sql
## WHERE CLAUSE
SELECT *
FROM parks_and_recreation.employee_salary
WHERE first_name = 'Leslie'
;
SELECT *
FROM parks_and_recreation.employee_salary
WHERE salary >= 50000
;
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE gender != 'Female'
;
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE birth_date > '1985-01-01'
;
#### AND / OR / NOT
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE birth_date > '1985-01-01'
OR NOT gender = 'Male'
;
## PEMDAS also applies to logical operations
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE (frist_name = 'Leslie' AND age = 44) OR age > 55
;
## LIKE statement % and _
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE first_name LIKE 'Jer%'
;
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE first_name LIKE 'a__'
;
SELECT *
FROM parks_and_recreation.employee_demographics
WHERE birth_date LIKE '1989%'
;