Lesson 9 Beginner Level
9 of 30 lessons

SQL Operators

Learn about arithmetic, comparison, and logical operators in Oracle SQL. Operators are essential for creating conditions and performing calculations in your queries.

What are SQL Operators?

Operators in SQL are special symbols or keywords used to perform operations on values, columns, or expressions. They are used in WHERE clauses to filter data, and also in SELECT clauses for calculations.

Types of Operators

Operator Category Description
=, <>, >, <, >=, <= Comparison Compare two values
AND, OR, NOT Logical Combine multiple conditions
+, -, *, / Arithmetic Perform math operations
BETWEEN, IN, LIKE Special Advanced conditional filtering

Example Queries

-- Employees with salary greater than 5000
SELECT first_name, salary
FROM employees
WHERE salary > 5000;

-- Employees in department 10 or 20
SELECT first_name, department_id
FROM employees
WHERE department_id IN (10, 20);

-- Names starting with 'A'
SELECT first_name
FROM employees
WHERE first_name LIKE 'A%';

Practice Task

  • Use comparison operators to list employees earning less than 3000.
  • Try using BETWEEN to select salaries between 4000 and 8000.