SQL Operators
NOT
Logical operator that displays a record if the condition(s) is NOT TRUE. Example SELECT * FROM Customers WHERE City NOT LIKE 's%';
AND
Logical operator that is true if all conditions separated by AND are true Example SELECT * FROM Customers WHERE City = "London" AND Country = "UK";
EXISTS
Logical operator that is true if the subquery returns one or more records Example SELECT * FROM Products WHERE EXISTS (SELECT Price FROM Products WHERE Price > 50);
To ask about and add
SQL Compound Operators Operator Description += Add equals -= Subtract equals *= Multiply equals /= Divide equals %= Modulo equals &= Bitwise AND equals ^-= Bitwise exclusive equals |*= Bitwise OR equals SQL Bitwise Operators Operator Description & Bitwise AND | Bitwise OR ^ Bitwise exclusive OR
Operator Overview
These are the SQL equivalent of filters. These are like if equations that only pull information when they conclude to be true.
>=
Comparison operator that checks if the first value is greater than or equal to the second value
ALL
Logical operator that is true if all of the subquery values meet the condition Example SELECT * FROM Products WHERE Price > ALL (SELECT Price FROM Products WHERE Price > 500);
OR
Logical operator that is true if any of the conditions separated by OR are true. Example SELECT * FROM Customers WHERE City = "London" OR Country = "UK";
ANY
Logical operator that is true if any of the subquery values meet the condition Example SELECT * FROM Products WHERE Price > ANY (SELECT Price FROM Products WHERE Price > 50);
SOME
Logical operator that is true if any of the subquery values meet the condition Example SELECT * FROM Products WHERE Price > SOME (SELECT Price FROM Products WHERE Price > 20);
IN
Logical operator that is true if the operand is equal to one of a list of expressions Example SELECT * FROM Customers WHERE City IN ('Paris','London');
BETWEEN
Logical operator that is true if the operand is within the range of comparisons Example SELECT * FROM Products WHERE Price BETWEEN 50 AND 60;
LIKE
Logical operator that is true if the operand matches a pattern Example SELECT * FROM Customers WHERE City LIKE 's%';
%
Modulo division Gives you the remainder of an integer division of the given numbers. Example 5 % 3 = 2 It does 5/3 in integer division, finds that 3 goes into 5 once and gives you the remainder of 2.
|
OR Requires that one of the values being OR'd together are true
+
Arithmetic operator that adds
/
Arithmetic operator that divides
*
Arithmetic operator that multiplies
-
Arithmetic operator that subtracts
>
Comparison operator that checks if the first value is greater than the second value
<=
Comparison operator that checks if the first value is less than or equal to the second value
<
Comparison operator that checks if the first value is less than the second value
<>
Comparison operator that checks if the first value is not equal to the second value
=
Comparison operator that checks if the two values are equal
+=
Compound operator
&
AND Requires that both of the values being AND together are true
