Logical Operators

Purpose: Used to combine multiple conditions in a WHERE clause.Operators:

  • AND: True if both conditions are true.
  • OR: True if at least one condition is true.
  • NOT: Reverses the result of a condition
  • Example:
SELECT * FROM employees WHERE salary > 50000 AND department_id = 10;

Explanation: This retrieves employees in department 10 with a salary greater than 50,000.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *