ADVERTISEMENT

SQL Operators List

SQL operators are symbols or keywords used to perform operations on data, such as comparisons, arithmetic calculations, logical evaluations, and more. Knowing the common operators helps you write precise and efficient queries.

🔹 Categories of SQL Operators

CategoryOperatorsPurpose
Arithmetic+, -, *, /, %Basic math operations
Comparison=, <> or !=, <, >, <=, >=Compare values (equal, not equal, less, greater, etc.)
LogicalAND, OR, NOTCombine or negate conditions
StringLIKE, NOT LIKEPattern matching with wildcards
SetIN, NOT INCheck for membership in a list/set
Null CheckIS NULL, IS NOT NULLTest for NULL values
Bitwise (DBMS-specific)&, `, ^, ~, <<, >>`

🔹 Common Operators Explained

-- Arithmetic
SELECT price, price * 0.10 AS tax FROM products;

-- Comparison
SELECT * FROM employees WHERE salary >= 50000;

-- Logical
SELECT * FROM orders WHERE status = 'Shipped' AND total > 100;

-- String
SELECT * FROM customers WHERE name LIKE 'A%';  -- names starting with A

-- Set
SELECT * FROM products WHERE category IN ('Electronics', 'Books');

-- Null Check
SELECT * FROM employees WHERE manager_id IS NULL;

🧠 Quick Recap

Operator TypeCommon OperatorsUse Case
Arithmetic+, -, *, /, %Calculations
Comparison=, <>, <, >, <=, >=Filtering by condition
LogicalAND, OR, NOTCombine multiple conditions
Pattern MatchingLIKEPartial text matching
Set MembershipIN, NOT INCheck against multiple values
Null TestingIS NULL, IS NOT NULLFind NULL or NOT NULL values

💡 Operators are the building blocks of your query logic—master them to write powerful SQL statements.

ADVERTISEMENT