codegurukool.com · Free coding tutorials & online compiler

Home › SQL Tutorial › SQL AND, OR, NOT

SQL AND, OR, NOT

Combine conditions.

AND needs both conditions true, OR needs one, NOT reverses a condition. Use parentheses to make the order clear.

Example code

SELECT name, city, country FROM Customers
WHERE (country = 'UK' OR country = 'India')
  AND NOT city = 'London';

Run this code in the online editor

← SQL ORDER BY and LIMITSQL INSERT INTO and NULL →