SQL – Operators
Master all SQL operators — arithmetic, comparison, logical, string, and bitwise — for precise query control.
Table of Contents
SQL operators are the building blocks of conditions and expressions. Knowing all of them gives you precision and power in your queries. Beyond the basics (=, >, AND), SQL includes arithmetic operators for calculations, string concatenation, range and list operators, and even bitwise operators for binary data.
Understanding operator precedence is critical — AND always binds tighter than OR, meaning A OR B AND C is evaluated as A OR (B AND C). When in doubt, use parentheses to make your intent explicit.
Operator Categories
| Type | Examples |
|---|---|
| Arithmetic | + - * / % |
| Comparison | = != < > <= >= |
| Logical | AND OR NOT |
| Range | BETWEEN, IN, LIKE |
| Null | IS NULL, IS NOT NULL |
| String | || (concatenate in SQLite) |
Try It Yourself — Interactive SQL Editor
Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.
Key Points
- AND has higher precedence than OR — use parentheses for clarity
- || is SQLite’s string concatenation operator (+ in SQL Server)
- Arithmetic operators work on numeric columns directly in SELECT
- Modulus (%) returns the remainder of division
Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.
In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.