Missing Keys and NULL Extraction
Concepts covered: sqlJsonExtract
The last design decision: when do you flatten a JSON column to typed columns, and when do you keep it nested? The choice depends on read patterns, schema stability, and consumer preferences. This section covers the trade-off and the closing. Flatten when Flatten the JSON column into typed columns when: the fields are stable (rarely change); consumers query them frequently (read amplification justifies the one-time extraction cost); the dashboard or BI tool prefers typed columns to JSON path syntax; compliance requires explicit column contracts. The flattened table is easier to query, easier to index, easier to optimize. The trade-off is the migration cost when the schema changes. Keep nested when Keep the JSON column nested when: the fields are unstable (frequent schema changes); consumers
About This Interactive Section
This section is part of the Semi-Structured Data: Intermediate lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.