
Answer-first summary for fast verification
Answer: All logic will execute at query time and return the result of joining the valid versions of the source tables at the time the query began.
The `CREATE VIEW` statement defines a view, which is a virtual table that executes its underlying query each time it is referenced. Since both users and orders are Delta Lake tables, Delta's transaction log ensures ACID transactions. When querying the view, Delta uses the version of the source tables valid at the **start** of the query to maintain consistency, even if the source tables are modified during query execution. The view does not store data (options A and B are incorrect). Option C is incorrect because it refers to versions at query completion, whereas Delta uses versions at query start (D).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A view is registered with the following code:
CREATE VIEW recent_orders AS (
SELECT a.user_id, a.email, b.order_id, b.order_date
FROM
(SELECT user_id, email
FROM users) a
INNER JOIN
(SELECT user_id, order_id, order_date
FROM orders
WHERE order_date >= (current_date() - 7)) b
ON a.user_id = b.user_id
)
Both users and orders are Delta Lake tables.
Which statement describes the results of querying recent_orders?
A view is registered with the following code:
CREATE VIEW recent_orders AS (
SELECT a.user_id, a.email, b.order_id, b.order_date
FROM
(SELECT user_id, email
FROM users) a
INNER JOIN
(SELECT user_id, order_id, order_date
FROM orders
WHERE order_date >= (current_date() - 7)) b
ON a.user_id = b.user_id
)
Both users and orders are Delta Lake tables.
Which statement describes the results of querying recent_orders?
A
The versions of each source table will be stored in the table transaction log; query results will be saved to DBFS with each query.
B
All logic will execute when the table is defined and store the result of joining tables to the DBFS; this stored data will be returned when the table is queried.
C
All logic will execute at query time and return the result of joining the valid versions of the source tables at the time the query finishes.
D
All logic will execute at query time and return the result of joining the valid versions of the source tables at the time the query began.