Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Custom Welcome Messages | Advanced CASE WHEN Logic
Mastering CASE WHEN in SQL

bookChallenge: Custom Welcome Messages

Tâche

Swipe to start coding

Write a query that generates a welcome_message column for each employee in the employees table. The welcome_message should be 'Welcome back, [name]!' if the employee's years_at_company is greater than 1, and 'Welcome, [name]!' otherwise. If the employee's name is NULL, use 'there' in place of the name.

  • Use a CASE WHEN expression to determine the correct greeting based on years_at_company.
  • Use the employee's name value in the message, or substitute 'there' if name is NULL.
  • The resulting column should be named welcome_message.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Custom Welcome Messages

Glissez pour afficher le menu

Tâche

Swipe to start coding

Write a query that generates a welcome_message column for each employee in the employees table. The welcome_message should be 'Welcome back, [name]!' if the employee's years_at_company is greater than 1, and 'Welcome, [name]!' otherwise. If the employee's name is NULL, use 'there' in place of the name.

  • Use a CASE WHEN expression to determine the correct greeting based on years_at_company.
  • Use the employee's name value in the message, or substitute 'there' if name is NULL.
  • The resulting column should be named welcome_message.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

some-alt