What are SQL Operators?
- SQL Operators are symbols or keywords used to perform operations on data and compare values in SQL queries.
Arithmetic Operators
- Arithmetic operators are used to perform mathematical calculations.
Operator Description
+ Addition
- Substraction
* Multiplication
/ Division
% Modulus
Comparison Operators
- Comparison operators compare two values.
Operator Description
= Equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
<> or != Not equal to
Logical Operators
- Logical operators combine multiple conditions.
Operator Description
AND Both conditions must be true
OR At least one condition must be true
NOT Reverses the condition
IN Operator
- The IN operator checks whether a value matches any value in a list.
SELECT *
FROM table_name
WHERE column_table IN (value1, value2);
SELECT *
FROM Employee
WHERE Department IN ('IT','HR')
BETWEEN Operator
- The BETWEEN operator selects value within a range.
SELECT *
FROM Employee
WHERE Salary BETWEEN 30000 AND 60000;
LIKE Operator
- The LIKE operator searches for a specific pattern in text.
SELECT *
FROM Employee
WHERE Name LIKE 'p%';
IS NULL Operator
- The IS NULL operator checks for empty (NULL) values.
SELECT *
FROM Employee
WHERE Email IS NULL;
Top comments (0)