nerdexam
Microsoft

DP-500 · Question #44

You are using an Azure Synapse Analytics serverless SQL pool to query network traffic logs in the Apache Parquet format. A sample of the data is shown in the following table. You need to create a…

The correct answer is A. JSON_VALUE. To extract the source IP address from semi-structured data within an Apache Parquet file using an Azure Synapse Analytics serverless SQL pool, you should use the JSON_VALUE function.

Query and transform data

Question

You are using an Azure Synapse Analytics serverless SQL pool to query network traffic logs in the Apache Parquet format. A sample of the data is shown in the following table. You need to create a Transact-SQL query that will return the source IP address. Which function should you use in the select statement to retrieve the source IP address?

Options

  • AJSON_VALUE
  • BFOR JSON
  • CCONVERT
  • DFIRST VALUE

How the community answered

(23 responses)
  • A
    91% (21)
  • C
    4% (1)
  • D
    4% (1)

Why each option

To extract the source IP address from semi-structured data within an Apache Parquet file using an Azure Synapse Analytics serverless SQL pool, you should use the JSON_VALUE function.

AJSON_VALUECorrect

The JSON_VALUE function is used in Transact-SQL to extract a scalar value from a JSON string. Since network traffic logs often contain semi-structured data that can be interpreted as JSON within Parquet files, JSON_VALUE is the appropriate function to parse and retrieve a specific field like the source IP address.

BFOR JSON

FOR JSON is used to format query results as JSON text, not to parse JSON data to extract values.

CCONVERT

CONVERT is used to change data types or character sets and is not designed for parsing JSON structures to extract specific fields.

DFIRST VALUE

FIRST_VALUE is a window function that returns the first value in an ordered set of rows, which is unrelated to parsing JSON data.

Concept tested: Azure Synapse serverless SQL pool - JSON parsing

Source: https://learn.microsoft.com/en-us/sql/t-sql/functions/json-value-transact-sql?view=sql-server-ver16

Topics

#Azure Synapse Analytics#Serverless SQL Pool#T-SQL JSON_VALUE#Querying semi-structured data

Community Discussion

No community discussion yet for this question.

Full DP-500 Practice