Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam DP-203 All Questions

View all questions & answers for the DP-203 exam

Exam DP-203 topic 2 question 9 discussion

Actual exam question from Microsoft's DP-203
Question #: 9
Topic #: 2
[All DP-203 Questions]

DRAG DROP -
You have an Azure Synapse Analytics workspace named WS1.
You have an Azure Data Lake Storage Gen2 container that contains JSON-formatted files in the following format.

You need to use the serverless SQL pool in WS1 to read the files.
How should you complete the Transact-SQL statement? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: openrowset -
The easiest way to see to the content of your CSV file is to provide file URL to OPENROWSET function, specify csv FORMAT.
Example:
SELECT *
FROM OPENROWSET(
BULK 'csv/population/population.csv',
DATA_SOURCE = 'SqlOnDemandDemo',
FORMAT = 'CSV', PARSER_VERSION = '2.0',
FIELDTERMINATOR =',',
ROWTERMINATOR = '\n'

Box 2: openjson -
You can access your JSON files from the Azure File Storage share by using the mapped drive, as shown in the following example:

SELECT book.* FROM -
OPENROWSET(BULK N't:\books\books.json', SINGLE_CLOB) AS json
CROSS APPLY OPENJSON(BulkColumn)
WITH( id nvarchar(100), name nvarchar(100), price float,
pages_i int, author nvarchar(100)) AS book
Reference:
https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/query-single-csv-file https://docs.microsoft.com/en-us/sql/relational-databases/json/import-json-documents-into-sql-server

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Maunik
Highly Voted 3 years ago
Answer is correct https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/query-json-files
upvoted 46 times
Lrng15
3 years ago
answer is correct as per this link
upvoted 2 times
...
...
gf2tw
Highly Voted 3 years ago
The question and answer seem out of place, there was no mention of the CSV and the query in the answer doesn't match up with openjson at all
upvoted 11 times
gssd4scoder
2 years, 10 months ago
agree with you, very misleading
upvoted 1 times
...
dev2dev
2 years, 8 months ago
Look at the WITH statement, the csv column can contain json data.
upvoted 1 times
...
vctrhugo
1 year, 3 months ago
The easiest way to see to the content of your JSON file is to provide the file URL to the OPENROWSET function, specify csv FORMAT, and set values 0x0b for fieldterminator and fieldquote.
upvoted 3 times
...
dead_SQL_pool
2 years, 10 months ago
Actually, the csv format is specified if you're using OPENROWSET to read json files in Synapse. The OPENJSON is required if you want to parse data from every array in the document. See the OPENJSON example in this link: https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/query-json-files#query-json-files-using-openjson
upvoted 12 times
gf2tw
2 years, 9 months ago
Thanks, you're right: "The easiest way to see to the content of your JSON file is to provide the file URL to the OPENROWSET function, specify csv FORMAT, and set values 0x0b for fieldterminator and fieldquote."
upvoted 5 times
...
...
...
evangelist
Most Recent 2 months, 2 weeks ago
To complete the Transact-SQL statement for reading JSON-formatted files using the serverless SQL pool in WS1, you should use OPENROWSET to access the data and OPENJSON to parse the JSON content. Here is the correct completion of the statement:
upvoted 1 times
...
This took me about 10 hours to understand this query
upvoted 1 times
...
ELJORDAN23
8 months, 2 weeks ago
Answer is correct: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-json-files#query-json-files-using-openjson
upvoted 2 times
...
kkk5566
1 year ago
Answer is correct
upvoted 1 times
...
mamahani
1 year, 4 months ago
openrowset / openjson
upvoted 1 times
...
zorko10
1 year, 11 months ago
does openjson do the same thing as jsoncontent ? I tried running a query on a json file and the auto filled code used jsoncontent instead of openjson
upvoted 1 times
...
Deeksha1234
2 years, 1 month ago
correct
upvoted 1 times
...
SebK
2 years, 6 months ago
Correct
upvoted 1 times
...
PallaviPatel
2 years, 8 months ago
correct
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...