Skip to content

Instantly share code, notes, and snippets.

@rafaeltedesco
Created November 21, 2022 16:42
Show Gist options
  • Select an option

  • Save rafaeltedesco/a8d4924380510ba4a0fcb18b9c10de43 to your computer and use it in GitHub Desktop.

Select an option

Save rafaeltedesco/a8d4924380510ba4a0fcb18b9c10de43 to your computer and use it in GitHub Desktop.
SELECT CASE EXAMPLE 01
SELECT * FROM sakila.customer;
SELECT
(CASE
WHEN active = 1 THEN 'ATIVO'
ELSE 'INATIVO'
END) AS user_active,
CONCAT(first_name, ' ', last_name) AS full_name,
YEAR(create_date) AS joined_at
FROM
sakila.customer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment