Skip to main content

SQL Logical Operators

You'll likely also want to filter data using several conditions---possibly more often than you'll want to filter by only one condition. Logical operators allow you to use multiple comparison operators in one query.

Each logical operator is a special snowflake, so we'll go through them individually in the following lessons. Here's a quick preview:

  • LIKE allows you to match similar values, instead of exact values.
  • IN allows you to specify a list of values you'd like to include.
  • BETWEEN allows you to select only rows within a certain range.
  • IS NULL allows you to select rows that contain no data in a given column.
  • AND allows you to select only rows that satisfy two conditions.
  • OR allows you to select rows that satisfy either of two conditions.
  • NOT allows you to select rows that do not match a certain condition.