Databricks Certified Data Engineer Associate · Free Practice Question Easy
Question 45
- A Dot (.)
- B Semicolon (;)
- C Colon (:)
- D Comma (,)
Reveal correct answer
Correct answer: A
Explanation
In Spark SQL, you access subfields of a STRUCT by using the dot (.) notation. For example, if you have a STRUCT column named address with subfields street, city, and zip_code, you would query these subfields as address.street, address.city, and address.zip_code. This syntax allows you to reference individual fields within the structured data.
A.
This is correct: Dot (.) is the correct syntax used in Spark SQL to query subfields within STRUCT data types. Using a dot allows you to access nested fields within a STRUCT data type in Spark SQL queries.
B.
This is incorrect: Semicolon (;) is not the syntax used in Spark SQL to query subfields within STRUCT data types. Semicolons are typically used to terminate SQL statements, not to access subfields within STRUCT data types.
C.
This is incorrect: Colon (:) is not the syntax used in Spark SQL to query subfields within STRUCT data types. Colons are not used for accessing subfields within STRUCT data types in Spark SQL.
D.
This is incorrect: Comma (,) is not the syntax used in Spark SQL to query subfields within STRUCT data types. Commas are typically used to separate columns or values in SQL queries, not to access subfields within a STRUCT data type.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
