30How do you query semi-structured data (JSON) in SQL, and when should you flatten vs keep it nested?▼mediumSnowflakeDatabricksAmazon2 replies◆ premiumModern warehouses store JSON natively, and querying it well separates strong data engineers from the rest. The signal is path access plus unnesting, and a clear call on when to flatten hot fields versus keep the schema-on-read flexibility.Open full answer →
45You have a wide table with one column per month. How do you unpivot it into tidy (key, month, value) rows?▼mediumSnowflakeDatabricksMicrosoft1 replies◆ premiumWide tables with a column per period are painless to read and painful to query. The signal is unpivoting to long format with UNPIVOT or a UNION/cross-join trick, and knowing how NULLs and types bite you.Open full answer →
56How do you query deeply nested JSON with arrays in SQL, and when do you flatten vs keep it nested?▼mediumSnowflakeDatabricksGoogle1 replies◆ premiumA flat path extract is easy; an array of objects three levels deep is where people freeze. The signal is LATERAL FLATTEN / UNNEST to explode arrays into rows and a clear rule for when to flatten vs query in place.Open full answer →