Question: Lesson 2 9 : CASE You can use a CASE statement to return certain values when certain scenarios are true. A CASE statement takes the
Lesson : CASE
You can use a CASE statement to return certain values when certain scenarios are true.
A CASE statement takes the following form:
CASE WHEN THEN WHEN second thing is true THEN
ELSE END
For example, in order to return the number of legs for each row in friendsofpickles, you could run:
SELECT
CASE WHEN species 'human' THEN ELSE END AS numlegs
FROM friendsofpickles;
Can you return the results with a column named sound that returns "talk" for humans, "bark" for dogs, and "meow" for cats?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
