
Explanation:
The code snippet first creates a Temporary View daily_sales that aggregates sales data by date, which is only accessible within the current session. It then creates a Global Temporary View global_daily_sales that references daily_sales, making the aggregated data available across different sessions within the same application. This does not result in an error and does not materialize the views on disk.
Ultimate access to all questions.
What is the outcome of executing the following Databricks Spark SQL code snippet?\nsql\nCREATE OR REPLACE TEMPORARY VIEW daily_sales AS\nSELECT date, SUM(amount) AS total_sales\nFROM sales\nGROUP BY date;\nCREATE OR REPLACE GLOBAL TEMP VIEW global_daily_sales AS\nSELECT * FROM daily_sales;\n
A
Generates an error since a Global Temporary View cannot reference a Temporary View.
B
Establishes a Temporary View named daily_sales and a Global Temporary View named global_daily_sales, both containing identical data. However, global_daily_sales is accessible across different sessions within the same application.
C
Produces two views, daily_sales and global_daily_sales, which are materialized on disk and accessible across various Spark sessions and applications.
D
Creates a session-scoped Temporary View daily_sales and a Global Temporary View global_daily_sales, with the latter being accessible in any session within the application, both views containing the same aggregated sales data by date.
No comments yet.