1 of 9

SQL Operators

Day 10

Shrikant Khode

​

2 of 9

Introduction

  • What are SQL Operators?

- Tools used in SQL to perform operations on data

3 of 9

Types of SQL Operators

  • Categories:
  • 1. Arithmetic Operators
  • 2. Comparison Operators
  • 3. Logical Operators
  • 4. Bitwise Operators
  • 5. Set Operators
  • 6. Miscellaneous Operators

4 of 9

Arithmetic Operators

  • Operators:
  • + (Addition)
  • - (Subtraction)
  • * (Multiplication)
  • / (Division)
  • % (Modulus)
  • Example: SELECT salary + bonus FROM employees;

5 of 9

Comparison Operators

  • Operators:
  • = (Equal)
  • != or <> (Not Equal)
  • > (Greater Than)
  • < (Less Than)
  • >= (Greater Than or Equal)
  • <= (Less Than or Equal)
  • Example: SELECT * FROM employees WHERE salary > 50000;

6 of 9

Logical Operators

  • Operators:
  • - AND
  • - OR
  • - NOT
  • Example: SELECT * FROM employees WHERE department = 'Sales' AND salary > 50000;

7 of 9

Bitwise Operators

  • Operators:
  • - & (AND)
  • - | (OR)
  • - ^ (XOR)
  • - ~ (NOT)
  • - << (Left Shift)
  • - >> (Right Shift)
  • Example: SELECT 5 & 3;

8 of 9

Set Operators

  • Operators:
  • UNION
  • UNION ALL
  • INTERSECT
  • EXCEPT
  • Example: SELECT name FROM employees UNION SELECT name FROM managers;

9 of 9

Miscellaneous Operators

  • Operators:
  • BETWEEN
  • IN
  • LIKE
  • IS NULL
  • Example: SELECT * FROM employees WHERE name LIKE 'A%';