Week 49 – Intermediate

Did you know that JSON parsing has an evil brother called XML parsing? Well, here he is and is ready to be defeated.

create table week49 (
    data variant
);

insert into week49
select parse_xml('<?xml version="1.0" encoding="UTF-8"?>
<library>
    <book>
        <title>The Great Gatsby</title>
        <author>F. Scott Fitzgerald</author>
        <year>1925</year>
        <publisher>Scribner</publisher>
    </book>
    <book>
        <title>To Kill a Mockingbird</title>
        <author>Harper Lee</author>
        <year>1960</year>
        <publisher>J. B. Lippincott & Co.</publisher>
    </book>
    <book>
        <title>1984</title>
        <author>George Orwell</author>
        <year>1949</year>
        <publisher>Secker & Warburg</publisher>
    </book>
</library>
');

Your result should look like the below

Remember, if you want to participate:

  1. Sign up as a member of Frosty Friday. You can do this by clicking on the sidebar, and then going to ‘REGISTER
  2. Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
  3. Post the URL in the comments of the challenge

3 responses to “Week 49 – Intermediate”

  1. ChrisHastie avatar
    ChrisHastie

    My first time actually trying to parse XML through Snowflake. Thanks for providing a simple structure for the challenge!

    • Solution URL – https://github.com/ChrisHastieIW/Frosty-Friday
  2. dsmdavid avatar
    dsmdavid

    Thanks for the challenge. No matter what day of the week, or what time of day…I truly dislike xml…

    • Solution URL – https://github.com/dsmdavid/frostyfridays-sf/blob/main/models/challenge_49_02.sql
  3. Chris B avatar
    Chris B

    Good practice

    • Solution URL – https://github.com/ChrisBo94/FrostyFriday/blob/main/Week_49.sql

Leave a Reply