
Ultimate access to all questions.
A data engineer has joined an existing project and they see the following query in the project repository:
CREATE STREAMING LIVE TABLE loyal_customers AS
SELECT customer_id -
FROM STREAM(LIVE.customers)
WHERE loyalty_level = 'high';
CREATE STREAMING LIVE TABLE loyal_customers AS
SELECT customer_id -
FROM STREAM(LIVE.customers)
WHERE loyalty_level = 'high';
Which of the following describes why the STREAM function is included in the query?
A
The STREAM function is not needed and will cause an error.
B
The table being created is a live table.
Explanation:
The STREAM() function is used in Databricks SQL to indicate that the source table (LIVE.customers) is a streaming live table.
Here's why option C is correct:
Streaming Live Tables: In Databricks Delta Live Tables (DLT), there are two main types of tables:
STREAM() function purpose: When you use STREAM(LIVE.table_name), you're telling DLT that:
customers) is a streaming sourceContext in the query: The query is creating a STREAMING LIVE TABLE called loyal_customers. To create a streaming table from another table, that source table must also be a streaming source, hence the need for STREAM(LIVE.customers).
Why other options are incorrect:
In summary, STREAM(LIVE.customers) is used because customers is a streaming live table, and you need to read from it as a streaming source to create another streaming live table.