Databricks-Spark-Assoc Using Spark SQL Practice Question
Which SQL function is used to create a temporary view that persists only for the duration of the current Spark session?
⚠ Common exam trap
Candidates often confuse 'TEMPORARY VIEW' with 'GLOBAL TEMPORARY VIEW'. They fail to realize that global views persist across sessions, whereas standard temporary views are strictly session-scoped and disappear upon termination.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
CREATE TEMPORARY VIEW
The CREATE TEMPORARY VIEW statement is the standard method for registering a DataFrame or table as a temporary view. These views are scoped to the SparkSession, making them invisible to other sessions or users. This is critical for modularizing complex SQL pipelines where intermediate results need to be referenced by name without polluting the global metastore or requiring permanent persistence in underlying storage.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
CREATE GLOBAL TABLE
Why it's wrong here
Global tables are persistent structures stored in the metastore that persist across different sessions and users. They are not intended for temporary, session-scoped data referencing, as they require explicit management and storage allocation, making them unsuitable for ephemeral data processing tasks that should not leave traces after the job completes.
- ✓
CREATE TEMPORARY VIEW
Why this is correct
This command creates a temporary view that exists only within the current SparkSession. It is the ideal tool for ad-hoc analysis or intermediate transformations where the data does not need to be saved to long-term storage or shared across different clusters or users within the organization's wider data environment.
- ✗
CREATE PERSISTENT VIEW
Why it's wrong here
Persistent views are saved to the metastore and remain accessible after the session terminates. They are used for shared datasets that multiple users or processes need to query repeatedly, which is the opposite of the requested temporary, session-scoped behavior required for managing ephemeral data during complex ETL execution.
- ✗
CREATE SESSION TABLE
Why it's wrong here
There is no SQL command named CREATE SESSION TABLE in Spark SQL. Using incorrect syntax will result in a parsing error. Spark SQL uses the TEMPORARY VIEW or GLOBAL TEMPORARY VIEW nomenclature to define the scope and visibility of intermediate datasets within the Spark execution engine's memory management system.
About these practice questions
This Databricks-Spark-Assoc question is part of Courseiva's 295-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-Spark-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-Spark-Assoc exam.