Code has been added to clipboard!

Operators: A Cheat Sheet

Reading time 2 min
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;
Udacity
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
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

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
+= Add assignment
-= 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

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 28/02/2021
3176 People Used
Only 97 Left
Rating
5.0