internalsGet Pro

Module 02 · Lesson 7 of 12Pro

Semi-structured data: querying JSON in SQL

Level
Intermediate
Topic
SQL for data engineering
Reading time
17 min

When you finish this page you can

  1. Extract fields from a JSON column with DuckDB’s operators and functions, and cast each one to a checked type.
  2. Tell a missing field, a JSON null and a value of the wrong type apart, and count each one.
  3. Turn a JSON array into one row per element without losing the events whose array is empty or absent.
  4. Decide which fields to flatten into typed columns at load time and why the raw JSON stays beside them.
  1. Design: a first analytics pipeline for an online store30 min
  2. NULLs and messy values in SQL16 min

Add-to-cart value fell 35% on a normal day

It’s 09:30 on Tuesday, 10 November, at , an online store in India. Every night Meera, Kartly’s data engineer, copies the store’s orders and click events from its database into an analytical store. The product team reads click numbers from there.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan