5.7 Other data types

5.27

with json_table as (
    select
        JSON(
            '{"first": "Matt",
            "last": "Forrest",
            "age": 35}'
        ) as data
)

select
    data
from
    json_table 

5.28

with json_table as (
    select
        JSON(
            '{"first": "Matt",
            "last": "Forrest",
            "age": 35}'
        ) as data
)
select
    data -> 'last'
from
    json_table

5.29

with json_table as (
    select
        JSON(
            '{
                "first": "Matt",
                "last": "Forrest",
                "age": 35,
                "cities": ["Minneapolis", "Madison", "New York City"],
                "skills": {"SQL": true, "Python": true, "Java": false}
            }'
        ) as data
)
select
    data
from
    json_table

5.30

with json_table as (
    select
        JSON(
            '{
                "first": "Matt",
                "last": "Forrest",
                "age": 35,
                "cities": ["Minneapolis", "Madison", "New York City"],
                "skills": {"SQL": true, "Python": true, "Java": false}
            }'
        ) as data
)
select
    data -> 'cities' -> 1 as city,
    data -> 'skills' -> 'SQL' as sql_skills
from
    json_table

5.31

select
    cast(zipcode as numeric)
from
    nyc_zips
limit
    3

5.32

select
    zipcode :: numeric
from
    nyc_zips
limit
    3