
Answer-first summary for fast verification
Answer: Utilize the %sql magic command in a new cell where SQL is needed.
The %sql magic command is the correct choice as it allows for the execution context to be switched to SQL for specific cells within a notebook. This functionality is particularly useful for data querying and visualization tasks, enabling the seamless integration of SQL within a multi-language notebook environment.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
When working with a Databricks notebook in Python, what is the method to temporarily switch to SQL for a specific visualization task?
A
Rewrite the Python code in SQL and execute it in a new Python cell.
B
Export the data to a SQL database and start a new SQL notebook.
C
Change the entire notebook to SQL mode via the notebook settings.
D
Utilize the %sql magic command in a new cell where SQL is needed.