Using Logical Operators

Combining Conditions:

  • Logical operators like AND, OR, and NOT help combine multiple conditions in the WHERE clause.

Example:

SELECT * FROM employees
WHERE salary > 50000 AND department_id = 10;
Explanation: This retrieves all columns for employees with a salary greater than 50,000 and who are in department 10. Both conditions must be true for a record to be included in the results.

Comments

Leave a Reply

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