Code has been added to clipboard!

# Operators: A Cheat Sheet

Published Oct 2, 2019
Updated Oct 3, 2019

## Arithmetic operators

Operator Definition Example
+ Addition `SELECT 42 + 7;`
- Subtraction `SELECT 42 - 7;`
* Multiplication `SELECT 42 * 7;`
/ Division `SELECT 42 / 7;`
% Modulus `SELECT 42 % 7;`

## Comparison operators

Operator Definition Example
= Equal to ```SELECT * FROM Products WHERE Price = 11;```
> Greater than ```SELECT * FROM Products WHERE Price > 20;```
< Less than ```SELECT * FROM Products WHERE Price < 20;```
>= Greater than or equal to ```SELECT * FROM Products WHERE Price >= 20;```
<= Less than or equal to ```SELECT * FROM Products WHERE Price <= 20;```
<> Not equal to ```SELECT * FROM Products WHERE Price <> 20;```
Pros
• Easy to use with a learn-by-doing approach
• Offers quality content
• Gamified in-browser coding experience
• The price matches the quality
• Suitable for learners ranging from beginner to advanced
Main Features
• Free certificates of completion
• Focused on data science skills
• Flexible learning timetable
Pros
• Simplistic design (no unnecessary information)
• High-quality courses (even the free ones)
• Variety of features
Main Features
• Nanodegree programs
• Suitable for enterprises
• Paid Certificates of completion
Pros
• Easy to navigate
• No technical issues
• Seems to care about its users
Main Features
• Huge variety of courses
• 30-day refund policy
• Free certificates of completion

## Logical operators

Operator True if
ALL All of the subquery values meet the condition
AND All the conditions separated by AND are TRUE
ANY Any of the subquery values meet the condition
BETWEEN The operand is within the range of comparisons
EXISTS The subquery returns one or more records
IN The operand is equal to one of the listed expressions
LIKE The operand matches a pattern
NOT The condition(s) is NOT TRUE
OR Any of the conditions separated by OR are TRUE
SOME Any of the subquery values meet the condition

## Compound operators

Operator Definition
-= Subtract assignment
*= Multiply assignment
/= Divide assignment
%= Modulus assignment

## Bitwise operators

Note: while bitwise SQL operators might seem similar to the logical SQL operators, they convert integers into binary bits and then perform the operations on each of them. The result is always an integer.

Operator Definition
& Bitwise AND
&= Bitwise AND EQUALS
| Bitwise OR
|= Bitwise OR EQUALS
^ Bitwise exclusive OR
^= Bitwise exclusive OR EQUALS
~ Bitwise NOT

Days
Hours
Minutes
Seconds