Operators
rclarkeweb5 total contributions
Published May 10, 2021Updated Dec 21, 2022
Contribute to Docs
Operators are unique keywords used to perform arithmetic, comparison, and logical operations. They are commonly used in the WHERE
clause of an expression.
Arithmetic Operators
Arithmetic operators are used to perform arithmetic on numeric types:
+
: Addition-
: Subtraction*
: Multiplication/
: Division%
: Modulo (remainder)
Example
-- Addition10 + 5-- Subtraction10 - 5-- Multiplication10 * 5-- Division10 / 5-- Modulo10 % 5
Comparison Operators
Comparison operators can be used to compare two values:
=
: Equal to>
: Greater than<
: Less than>=
: Greater than or equal to<=
: Less than or equal to!=
: Not equal<>
: Not equal to
Example
SELECT *FROM studentsWHERE gpa > 25;
Logical Operators
Logical operators can be used to combine multiple conditions such as AND
, OR
, NOT
or perform operations such as NOT
and BETWEEN
.
Operators
- AND
- Tests if all conditions in a given expression evaluate to TRUE.
- BETWEEN
- Selects values, inclusively of beginning and end values, within a given range. BETWEEN works with numbers, text, or date data types.
- EXISTS
- Tests a subquery and returns TRUE if at least one record satisfies it.
- IN
- Allows the user to specify multiple values in the WHERE clause.
- IS NOT NULL
- Checks if a value is not NULL.
- IS NULL
- Checks if a value is NULL.
- LIKE
- Returns `TRUE` if its first text argument matches the wildcard pattern in its second argument.
- NOT
- Queries for items in an expression that return NOT TRUE for some condition(s).
- OR
- Test if any condition in a given expression evaluates to TRUE.
All contributors
- rclarkeweb5 total contributions
- BrandonDusch580 total contributions
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- JeremyBarbosa18 total contributions
- rclarkeweb
- BrandonDusch
- christian.dinh
- Anonymous contributor
- JeremyBarbosa
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.