Databricks Certified Data Engineer Associate — Question 35

A data engineer has a Python notebook in Databricks, but they need to use SQL to accomplish a specific task within a cell. They still want all of the other cells to use Python without making any changes to those cells.

Which of the following describes how the data engineer can use SQL within a cell of their Python notebook?

Answer options

Correct answer: D

Explanation

The correct answer is D because adding %sql at the beginning of the cell allows the data engineer to execute SQL commands within a Python notebook without affecting other cells. Option A is incorrect because it is indeed possible to use SQL in a Python notebook. Options B and E are unnecessary since the correct method does not require changing the endpoint or the notebook's default language, while C is incorrect as it does not specify the required syntax for SQL execution.