The usual logical operators are AND, OR, and NOT.

SQL uses a three-valued Boolean logic where the null value represents "unknown". For more information, see the following truth tables.

a | b | a AND b | a OR b |
---|---|---|---|

True | True | True | True |

True | False | False | True |

True | Null | Null | True |

False | False | False | False |

False | Null | False | Null |

Null | Null | Null | Null |

a | NOT a |
---|---|

True | False |

False | True |

Null | Null |

The operators AND and OR are commutative. You can switch the left and right operand without affecting the result.