- example |
SELECT * FROM log_in_attempts WHERE time > '18:00';
- data consisting of an ordered sequence of characters
- characters could be numbers, letters, or symbols
- data consisting of numbers
- mathematical operations can be used on numeric data, like multiplication or addition
- data representing a date and/or time
=
; >
; <
; <>
(not equal to) or !=
; >=
; <=
- an operator that filters for numbers or dates within a range
- used for numeric data as well as date and time data
- inclusive operator
- example |
SELECT * FROM machines WHERE OS_patch_date BETWEEN '2021-03-01' AND '2021-09-01';
- an operator that does not include the value of comparison
- example |
>
- an operator that includes the value of comparison
- example |
>=
- specifies that both conditions must be met simultaneously
- example |
SELECT * FROM machines WHERE operating_system = 'OS 1' AND email_client = 'Email Client 1';
- specifies that either condition can be met
- example |
SELECT * FROM machines WHERE operating_system = 'OS 1' OR operating_system = 'OS 3';
- negates a condition
- only works on a single condition, and not on multiple ones
- example |
NOT
| SELECT * FROM machines WHERE NOT operating_system = 'OS 3';
- example |
<>
| SELECT * FROM machines WHERE operating_system <> 'OS 3';
- example |
!=
| SELECT * FROM machines WHERE operating_system != 'OS 3';
AND
, OR
, and NOT
allow you to filter your queries to return the specific information
- logical operators can be combined in filters
- example |
SELECT firstname, lastname, email, country FROM customers WHERE NOT country = 'Canada' AND NOT country = 'USA';