JSON in SQL
JSON in SQL — Work with JSON data in SQL — JSON_VALUE, JSON_QUERY, JSON_TABLE, and JSON aggregation functions. The guide walks through JSON Data Types, JSON_VALUE() & JSON_EXTRACT(), JSON_QUERY() & JSON Modifiers, JSON_TABLE() — JSON to Relational, JSON Aggregation Functions, JSON Path Expressions. PostgreSQL: JSON (stores exact copy) and JSONB (binary, indexed). MySQL: JSON type (validated, binary). SQL Server: NVARCHAR with JSON functions. JSONB supports indexing with GIN indexes for efficient queries on nested values. Use JSON for logging configuration changes, flexible metadata, and storing semi-structured data alongside relational columns. JSON_VALUE(json, '$.key') extracts a scalar value as SQL text/number (SQL Server/PostgreSQL). MySQL: JSON_EXTRACT(json, '$.key') or -> operator. PostgreSQL: json->>'key' returns text, json->'key' returns JSON. Path syntax supports array access: '$.items[0].name'. Shortcuts: jsonb_extract_path_text() (PostgreSQL), column->>key for direct property access. The guide is organized into 6 sections that build on each other, each pairing a prose explanation with real SQL you can run as-is.