Databricks Certified Associate Developer for Apache Spark — Question 138

Which of the following code blocks uses SQL to return a new DataFrame containing column storeId and column managerName from a table created from DataFrame storesDF?

Answer options

Correct answer: D

Explanation

Option D is correct because it properly creates a temporary view named 'stores' from storesDF and then executes a SQL query to select the desired columns. The other options either do not create the view correctly or use incorrect methods for querying, making them invalid for the task at hand.