Databricks Data Engineer Associate Question 510
Single answerYou are working on a Databricks project where you need to query a table using the three-layer namespace structure. The catalog is named analytics, the schema is sales_data, and the table is monthly_revenue. Which of the following queries correctly retrieves data from this table?
- A
SELECT * FROM analytics.sales_data.monthly_revenue
- B
SELECT * FROM sales_data.monthly_revenue
- C
SELECT * FROM monthly_revenue
- D
SELECT * FROM analytics.monthly_revenue.sales_data
Show answer and explanation
Correct answer: A
Explanation
In Databricks, the three-layer namespace (catalog.schema.table) is used to organize and query data. This structure helps manage data assets across multiple databases and schemas. The correct syntax is catalog.schema.table, and in this example, querying the table correctly requires including all three layers in the query as analytics.sales_data.monthly_revenue.
- A. Correct.
This is the correct syntax for querying a table using the three-layer namespace structure: catalog.schema.table.
- B. Incorrect.
This syntax is incorrect because it omits the catalog layer, which is required in the three-layer namespace structure.
- C. Incorrect.
This syntax is incorrect because it omits both the catalog and schema layers, which are required in the three-layer namespace structure.
- D. Incorrect.
This syntax is invalid because it incorrectly orders the namespace layers (catalog.table.schema instead of catalog.schema.table).