🙏 We need your help! SQLtest.online has no ads and lives only on donations. Even a small amount helps. Donate now →
SQL code copied to buffer
Task 64:

Helmets as JSON for the Online Shop

SQL Server 2022
The online shop loads product cards as JSON. For the Sport-100 helmets (their Name starts with Sport-100 Helmet) in the Product table, build a JSON object with the keys name, color and price (from Name, Color and ListPrice), in this order, for example:
{ "name":"Sport-100 Helmet, Black","color":"Black","price":34.9900 } (without the spaces after the opening and before the closing brace).
Output the columns ProductNumber and product_json, sorted by ProductNumber.
Expected result Columns: 2 · Rows: 3
ProductNumber product_json

Write your query below and click "Check it!". Tables are described in the right pane.

Tutorial

By checking a query, you agree that it is stored without your account details and may be included in anonymized datasets, including for AI training. Learn more

The query result will appear here. Ctrl+Enter - Run query