This week we’re going to be undoing what people usually do and we’re going to be turning a table into a JSON VARIANT object.
Here we have a table with info on a set of superheroes, your job is to turn this table into a JSON VARIANT object.
Here’s the start-up code
CREATE OR REPLACE TABLE week_14 (
superhero_name varchar(50),
country_of_residence varchar(50),
notable_exploits varchar(150),
superpower varchar(100),
second_superpower varchar(100),
third_superpower varchar(100)
);
INSERT INTO week_14 VALUES ('Superpig', 'Ireland', 'Saved head of Irish Farmer\'s Association from terrorist cell', 'Super-Oinks', NULL, NULL);
INSERT INTO week_14 VALUES ('Señor Mediocre', 'Mexico', 'Defeated corrupt convention of fruit lobbyists by telling anecdote that lasted 33 hours, with 16 tangents that lead to 17 resignations from the board', 'Public speaking', 'Stamp collecting', 'Laser vision');
INSERT INTO week_14 VALUES ('The CLAW', 'USA', 'Horrifically violent duel to the death with mass murdering super villain accidentally created art installation last valued at $14,450,000 by Sotheby\'s', 'Back scratching', 'Extendable arms', NULL);
INSERT INTO week_14 VALUES ('Il Segreto', 'Italy', NULL, NULL, NULL, NULL);
INSERT INTO week_14 VALUES ('Frosty Man', 'UK', 'Rescued a delegation of data engineers from a DevOps conference', 'Knows, by memory, 15 definitions of an obscure codex known as "the data mesh"', 'can copy and paste from StackOverflow with the blink of an eye', NULL);
RESULT
Remember if you want to participate:
- Sign up as a member of Frosty Friday. You can do this by clicking on the sidebar, and then going to ‘REGISTER‘ (note joining our mailing list does not give you a Frosty Friday account)
- Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
- Post the URL in the comments of the challenge.
16 responses to “Week 14 – Basic”
-
seemingly simple but not quite
- Solution URL – https://github.com/mateusz-kmon/frostyfridaychallenges/blob/main/w14.sql
-
That was a nice way to demonstrate how easily you can create/manipulate JSON data with Snowflake
- Solution URL – https://github.com/ChrisHastieIW/Frosty-Friday
-
I have to admit I’m more used to do the opposite of this 🙂
My approach:
– Create a base table to insert the values.
– Create a second view with the objects.- Solution URL – https://github.com/dsmdavid/frostyfridays-sf/blob/main/models/challenge_14_02.sql
-
Quite an easy one this week. Good practice if you want to build an API on top of Snowflake to expose some of your data.
- Solution URL – https://github.com/ChrisBBiztory/FrostyFriday/blob/main/Week_14.sql
-
My solution for this weekly challenge
- Solution URL – https://github.com/isarenz/FrostyFridayChallenges/blob/main/FrostyFriday_Challenge_Week14..sql
-
Nice refresher on how to generate json out of relational table.
- Solution URL – https://github.com/pekka-kanerva/frosty-friday/blob/main/week14/ff-week14-solution.sql
-
A great way to familiar yourself with arrays and Json structure.
A Fun one!- Solution URL – https://github.com/Atzmonky/snowflake/blob/main/ch14_Arrays.sql
-
My Solution for week 14
- Solution URL – https://github.com/anakomissaroff/Frosty_Friday/blob/main/week14.sql
-
Another great challenge. Learned some basic but handy stuff here.
- Solution URL – https://github.com/apd-jlaird/frosty-friday/blob/main/week_14/ff_week_14.sql
-
Good to try some basic ones to learn the documents in more details.
- Solution URL – https://github.com/zlzlzl2-data/FrostyFriday/blob/main/FF14_LZ.sql
-
Took me quite some time to explore creating jsons and parts of jsons…
- Solution URL – https://github.com/arjansnowflake/Frosty_Friday/blob/main/Week_14/week_14.sql
-
Lovely stuff!
- Solution URL – https://github.com/canonicalized/FrostyFriday/blob/main/WEEK14.sql
-
super
- Solution URL – https://github.com/NMangera/frosty_friday/blob/main/week%2014%20-%20basic/JSON
-
Fun quick challenge 🙂
- Solution URL – https://github.com/darylkit/Frosty_Friday/blob/main/Week%2014%20-%20JSON/json.sql
-
This is my version of the solution for this task. I hope you find it helpful! ^^
- Solution URL – https://github.com/GerganaAK/FrostyFridays/blob/main/Week%2014%20%E2%80%93%20Basic
-
I like ARRAY_CONSTRUCT_COMPACT !
- Solution URL – https://github.com/gakut12/Frosty-Friday/blob/main/week14_basic_json/week14.sql
Leave a Reply
You must be logged in to post a comment.