Following week 57, we’re continuing with our SELECT options with REPLACE!
Given our start-up code below, we’d want you to do the following :
– subtract 1 from age (because the intern forgot that babies start at 0 , not 1)
– add 10% to everyone’s weight because the scale seemed to be off
– replace everyone’s gender to ‘unknown ‘ if it was marked ‘other’.
Start-up code
CREATE OR REPLACE TABLE measurements (
height INT,
weight INT,
age INT,
gender VARCHAR(),
id INT
);
insert into measurements (height, weight, age, gender, id) values (41, 178, 74, 'other', 1);
insert into measurements (height, weight, age, gender, id) values (188, 145, 87, 'other', 2);
insert into measurements (height, weight, age, gender, id) values (215, 725, 30, 'male', 3);
insert into measurements (height, weight, age, gender, id) values (159, 48, 116, 'female', 4);
insert into measurements (height, weight, age, gender, id) values (243, 204, 6, 'other', 5);
insert into measurements (height, weight, age, gender, id) values (232, 306, 30, 'male', 6);
insert into measurements (height, weight, age, gender, id) values (261, 602, 62, 'other', 7);
insert into measurements (height, weight, age, gender, id) values (143, 829, 113, 'female', 8);
insert into measurements (height, weight, age, gender, id) values (62, 190, 86, 'male', 9);
insert into measurements (height, weight, age, gender, id) values (249, 15, 73, 'male', 10);
The challenge is to do this with 1 query, with the end results looking like this :

(there might be a small trap hidden in our challenge this week so don’t get discouraged if you don’t get it on your first attempt)
Another quick challenge to highlight new functionality, thank you
My first challenge. Thanks FF
Really cool. Thanks for the challenge!
Thank you for pointing out new features. This is my default place for what’s new in Snowflake 🙂
Didn’t understand the question first, until seen others’ solutions. Idea is wrap everything within a replace.