Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Filtering

Select all rows from the customers table where the city is "Amsterdam":

SELECT *
FROM customers
WHERE city = 'Amsterdam';

Select all rows from the customers table where the customer_id is 6 or 7:

SELECT *
FROM customers
WHERE
  customer_id = 6
  OR customer_id = 7;

Select all rows from the customers table where the first_name includes "mark" (case-sensitive):

SELECT *
FROM customers
WHERE first_name LIKE '%mark%';

Select all rows from the customers table where the first_name includes "mark" (case-insensitive):

SELECT *
FROM customers
WHERE first_name ILIKE '%mark%';