An Azure SQL database named SalesDB stores Sales.Orders and Sales.OrderLines. A Retrieval Augmented Generation service fetches order details and hands them to a large language model as JSON. You must emit one JSON array in which every order object carries its header fields plus a lines array of its items.
[
{
"orderHeaderId": 102348,
"orderNumber": "SO-2026-000912",
"orderDateUtc": "2026-01-28T14:22:09Z",
"customerId": 77821,
"currencyCode": "EUR",
"orderTotal": 149.97,
"lines": [
{
"lineNumber": 1,
"productId": 5012,
"sku": "CBL-USB-C-1M",
"quantity": 2,
"unitPrice": 19.99,
"lineTotal": 39.98
},
{
"lineNumber": 2,
"productId": 8841,
"sku": "HUB-USB-C-7P",
"quantity": 1,
"unitPrice": 109.99,
"lineTotal": 109.99
}
]
}
]
21. Which Transact-SQL commands produce the needed shape from the relational tables? Serialize the order-level JSON: ____ Generate a nested lines array: ____ Extract a single scalar value from the JSON text: ____
Pick the right command for each purpose.
- FOR JSON PATH
- JSON_MODIFY
- JSON_QUERY
- JSON_VALUE
- OPENJSON