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 penguins table:

SELECT *
FROM penguins;

Select the species and island columns from the penguins table:

SELECT
  species,
  island
FROM penguins;

Select the first 10 rows from the penguins table:

SELECT *
FROM penguins
LIMIT 10;

Select all unique species values from the penguins table:

SELECT DISTINCT species
FROM penguins;

Select all columns except the island column from the penguins table:

SELECT * EXCLUDE (island)
FROM penguins;

Select all columns from the penguins table, but replace species with lower(species):

SELECT * REPLACE (lower(species) AS species)
FROM penguins;