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

Selecting

Select all columns from the customers table:

SELECT *
FROM customers;

Select the first_name and city columns from the customers table:

SELECT
  first_name,
  city
FROM customers;

Select the first 10 rows from the customers table:

SELECT *
FROM customers
LIMIT 10;

Select all unique city values from the customers table:

SELECT DISTINCT city
FROM customers;

Select all columns except the city column from the customers table:

SELECT * EXCLUDE (city)
FROM customers;

Select all columns from the customers table, but replace city with lower(city):

SELECT * REPLACE (lower(city) AS city)
FROM customers;