The TO_JSON function in Snowflake is used to convert relational data into a JSON-formatted string. It is the appropriate function to use when unloading a relational table into a JSON file, as it serializes the data into a JSON representation.
D. TO_JSON
Explanation:
TO_JSON is used to convert relational data into JSON format, which is ideal when unloading a relational table into a JSON file.
Why the others are wrong:
A. PARSE_JSON: This function is used to parse a JSON string into a Snowflake-compatible format, not for converting relational data into JSON.
B. JSON_EXTRACT_PATH_TEXT: This function extracts specific values from JSON data, but it doesn't convert relational data into JSON.
C. OBJECT_CONSTRUCT: This creates a JSON object from key-value pairs, but it doesn't convert the entire relational data into JSON format.
Example of using TO_JSON:
SELECT TO_JSON(OBJECT_CONSTRUCT(*)) FROM my_table;
upvoted 2 times
...
Log in to ExamTopics
Sign in:
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.
pieterjacobi1
3 weeks, 3 days agoMatthieuDN
3 weeks, 5 days agoNPass
2 weeks, 4 days agoMatthieuDN
1 month agomd_2000
4 months, 1 week ago