Before you start
You need Workbench and a running SQL engine. Every example includes its own input rows. No catalog, files, credentials, or external data is needed. These queries create no stored tables. Copy the SQL into Workbench and run the statements in order. Compare the result with the table below the query.WITH names input data for one statement only. Each example can run on its own.
1. Read a nested JSON field
Who is named in each payload?
Use a literal object path. This example reads JSON text.
Change one thing: Use $.missing as the path. Both results are NULL.
2. Convert a JSON number
What are the numeric amounts?
JSON_EXTRACT_STRING returns text. Cast it for numeric use.
Change one thing: Wrap the cast in COALESCE(…, 0). ID 2 returns zero.
3. Find a missing JSON value
Which payload has no amount?
A missing field and a JSON null both return SQL NULL.
Change one thing: Use IS NOT NULL. Only ID 1 appears.
4. Count array values
How many tags does each item have?
The result is a scalar count rather than an array column.
Change one thing: Add a third tag to item 1. Its count becomes 3.
5. Test array membership
Which item has a sale tag?
ARRAY_CONTAINS checks whether a value occurs in an array.
Change one thing: Search for games. Only ID 2 appears.
6. Read a struct field
Can a structured record expose its name?
A struct groups named fields. GET_FIELD reads one field.
Change one thing: Read id instead of name. Expect 1 and 2 in the second column.