SQL Analytics on Databricks
Question 1: Materialized views and refresh schedules
You are working with a large dataset containing millions of customer transactions. You need to create a view that shows monthly sales summaries by department. This summary involves complex aggregations and joins that take several minutes to compute each time they are executed. The business team needs to access this data frequently throughout the day, but the underlying transaction data is only updated once every 4 hours.
Which type of view would be most appropriate for this scenario, and what additional configuration should you implement?
- A Create a temporary view because it is faster and does not take up storage space
- B Create a materialized view with manual refresh only, refreshing it whenever the business team requests updated data
- C Create a materialized view with scheduled refresh every 4 hours to align with the data update frequency
- D Create a standard view because it will always show the most up-to-date data
Answer and rationale
Answer: C
Rationale
- A is incorrect. Temporary views do not solve the repeated expensive computation problem for business users.
- B is incorrect. Manual refresh would create unnecessary dependency on user requests.
- C is correct. A materialized view stores precomputed results, and a 4-hour schedule matches the data update cycle.
- D is incorrect. A standard view recomputes the query each time, which is inefficient for this scenario.
Question 2: CTAS
Which SQL statement is recommended for creating Delta Lake tables from existing data in Databricks?
- A DROP TABLE
- B UPDATE TABLE
- C CREATE TABLE _ AS SELECT (CTAS)
- D INSERT INTO
Answer and rationale
Answer: C
Rationale
- A is incorrect. DROP TABLE removes a table.
- B is incorrect. UPDATE TABLE modifies existing rows and is not used to create tables.
- C is correct. CTAS creates a table from the result of a SELECT query.
- D is incorrect. INSERT INTO adds rows to an existing table.
Question 3: Privilege grants
Which entity is responsible for granting privileges on data objects?
- A Workspace Administrator
- B Databricks Account Administrator
- C Billing Administrator
- D Data object owner
Answer and rationale
Answer: D
Rationale
- A is incorrect. Workspace administrators do not automatically own all data objects.
- B is incorrect. Account administrators manage account-level settings, not necessarily object privileges.
- C is incorrect. Billing administrators manage billing, not data object privileges.
- D is correct. The data object owner can grant privileges on that object.
Question 4: Streaming tables prerequisite
What must you do before creating streaming tables with Databricks SQL?
- A Request admin access
- B Install a Python library
- C Create a dashboard
- D Select a SQL warehouse
Answer and rationale
Answer: D
Rationale
- A is incorrect. Admin access is not the stated prerequisite.
- B is incorrect. Installing a Python library is not required for this SQL workflow.
- C is incorrect. A dashboard is not required.
- D is correct. A SQL warehouse must be selected before creating streaming tables in Databricks SQL.
Question 5: Default catalog and schema
What is the primary benefit of setting a default catalog and schema in Databricks?
- A Avoids using the full three level namespace
- B Limits data visibility
- C Allows querying Hive tables
- D Enables cluster auto-scaling
Answer and rationale
Answer: A
Rationale
- A is correct. Setting defaults lets users reference objects without the full catalog.schema.object name.
- B is incorrect. Visibility is controlled by permissions, not default namespace settings.
- C is incorrect. This is not primarily about querying Hive tables.
- D is incorrect. Auto-scaling is a compute feature.
Question 6: Data lineage
In the Catalog Explorer, which metadata concept shows end-to-end flow of data?
- A Object owner details
- B Data lineage
- C Query history
- D Data access controls
Answer and rationale
Answer: B
Rationale
- A is incorrect. Owner details identify responsibility, not data flow.
- B is correct. Data lineage shows how data flows through objects and processes.
- C is incorrect. Query history shows executed queries, not complete lineage.
- D is incorrect. Access controls show permissions, not flow.
Question 7: Unity Catalog namespace
What is the hierarchical structure of the Unity Catalog namespace?
- A Metastore.Schema.Catalog
- B Schema.Table.Catalog
- C Catalog.Schema.Data object
- D Workspace.Table.Schema
Answer and rationale
Answer: C
Rationale
- A is incorrect. Metastore is above catalogs and is not part of the three-level namespace.
- B is incorrect. The order is wrong.
- C is correct. Unity Catalog organizes data using catalog, schema, and data object.
- D is incorrect. Workspace is not part of the UC namespace hierarchy.
Question 8: Unity Catalog management scope
Unity Catalog centrally manages security, audit, and management for what?
- A Data and AI assets
- B Databricks Account identities
- C Cloud provider network settings
- D Workspace-level notebooks only
Answer and rationale
Answer: A
Rationale
- A is correct. Unity Catalog centrally governs data and AI assets.
- B is incorrect. Account identities are not the main managed assets described here.
- C is incorrect. Cloud network settings are managed outside Unity Catalog.
- D is incorrect. It is not limited to workspace notebooks.
Question 9: SQL Editor
You are a SQL developer who is used to working in traditional SQL editors for writing and running analytical queries. In Databricks, which tool provides the most similar experience?
- A Databricks SQL Editor
- B Lakeflow Spark Declarative Pipelines
- C Lakeflow Jobs
- D Databricks notebooks
Answer and rationale
Answer: A
Rationale
- A is correct. Databricks SQL Editor provides a traditional SQL query-writing experience.
- B is incorrect. Lakeflow pipelines are for declarative data pipelines.
- C is incorrect. Lakeflow Jobs are for job orchestration.
- D is incorrect. Notebooks are broader and multi-language, not most similar to a traditional SQL editor.
Question 10: Programmatic exploration
A data analyst needs to programmatically explore their Databricks environment. They want to view all schemas in the “production” catalog and then see all tables in the “sales” schema within that catalog. Which SQL statements should they use in the correct order?
- A SHOW CATALOGS; USE CATALOG production; SHOW TABLES IN sales;
- B USE SCHEMA sales; SHOW SCHEMAS; SHOW TABLES;
- C SHOW SCHEMAS IN production; SHOW TABLES IN production.sales;
- D SET DEFAULT CATALOG production; SHOW SCHEMAS; SHOW TABLES IN sales;
Answer and rationale
Answer: C
Rationale
- A is incorrect. It includes extra steps and does not directly show schemas in production first.
- B is incorrect. It does not first specify the production catalog.
- C is correct. It first lists schemas in the production catalog, then lists tables in production.sales.
- D is incorrect. SET DEFAULT CATALOG is not the direct statement pattern expected here.
Question 11: Standard views
You have created a standard view called sales_summary_vw that aggregates daily sales data from a transactions table. After creating the view, 100 new transactions are added to the transactions table. What happens when you query sales_summary_vw?
- A The view needs to be manually refreshed before it can include the new transactions
- B The view returns the original data from when it was created, ignoring the new transactions
- C The view returns an error because the underlying data has changed
- D The view automatically executes the stored query and includes the new transactions in the results
Answer and rationale
Answer: D
Rationale
- A is incorrect. Standard views do not require manual refresh.
- B is incorrect. Standard views do not store static results from creation time.
- C is incorrect. Underlying data changes do not automatically cause an error.
- D is correct. A standard view stores the query definition and executes it against current data.
Question 12: Unity Catalog function
What is the main function of Unity Catalog in Databricks?
- A To manage user accounts
- B To govern and manage datasets, including non-tabular files like CSVs
- C To create dashboards
- D To schedule jobs
Answer and rationale
Answer: B
Rationale
- A is incorrect. User account management is not the main function described.
- B is correct. Unity Catalog governs and manages datasets and files.
- C is incorrect. Dashboards are created in Databricks SQL/AI/BI tools.
- D is incorrect. Job scheduling is handled by workflow/job features.
Question 13: Identifying object owner
How can you programmatically identify the owner of a Databricks object?
- A DESCRIBE TABLE EXTENDED statement
- B SHOW SCHEMAS command
- C SELECT * FROM INFORMATION_SCHEMA
- D QUERY PERFORMANCE statement
Answer and rationale
Answer: A
Rationale
- A is correct. DESCRIBE TABLE EXTENDED can show detailed metadata including ownership.
- B is incorrect. SHOW SCHEMAS lists schemas, not object ownership details.
- C is incorrect. This option is too generic and not the expected method here.
- D is incorrect. QUERY PERFORMANCE is not used to identify object owners.
Question 14: Catalog Explorer usage
What is the primary purpose of using Catalog Explorer in Databricks?
- A To discover and inspect datasets for analytics
- B To write Python scripts
- C To monitor cluster
- D To manage compute resources
Answer and rationale
Answer: A
Rationale
- A is correct. Catalog Explorer helps users discover and inspect data assets.
- B is incorrect. Python scripts are written in notebooks or editors.
- C is incorrect. Cluster monitoring is not the primary Catalog Explorer function.
- D is incorrect. Compute resources are managed elsewhere.
Question 15: Files in Databricks volumes
Which statement best describes the types of files you can upload to a Databricks volume?
- A Only files smaller than 10 MB and in text format
- B Only files that will be immediately converted into Delta tables
- C Structured, semi structured, and unstructured files such as CSV, JSON, images, or PDFs
- D Only CSV files used for structured tables
Answer and rationale
Answer: C
Rationale
- A is incorrect. The option adds unsupported restrictions.
- B is incorrect. Files do not need to be immediately converted into Delta tables.
- C is correct. Volumes can store structured, semi-structured, and unstructured files.
- D is incorrect. Volumes are not limited to CSV files.
Question 16: Creating a table with read_files()
You have a CSV file named customer_data.csv stored in a Unity Catalog volume at /Volumes/company/marketing/files/. The file includes a header row, and you want to create a table named customers from this file using read_files().
Which option correctly reads the CSV file and creates the table?
- A
COPY INTO customers
FROM read_files('/Volumes/company/marketing/files/customer_data.csv')
FILEFORMAT = CSV;
- B
CREATE TABLE customers
AS SELECT * FROM read_files(/Volumes/company/marketing/files/customer_data.csv, header = True)
- C
CREATE TABLE customers AS
SELECT * FROM read_files(
'/Volumes/company/marketing/files/customer_data.csv',
header = True
);
- D
CREATE TABLE customers AS
SELECT * FROM read_files(
'/Volumes/company/marketing/files/customer_data.csv',
header => true
);
Answer and rationale
Answer: D
Rationale
- A is incorrect. COPY INTO is not the correct syntax shown for creating the table with read_files().
- B is incorrect. The file path is not quoted and the parameter syntax is incorrect.
- C is incorrect. The path is quoted, but it uses incorrect parameter assignment syntax.
- D is correct. It uses CTAS with read_files(), quotes the file path, and uses the correct named-parameter syntax header => true.
Question 17: Query performance analysis
You run a complex SQL query with an INNER JOIN and GROUP BY in Databricks SQL. The query completes successfully, but takes longer than expected. You want to understand why the query took that long and where time was spent during execution.
- A Review warehouse monitoring metrics to understand overall system utilization
- B Download query execution logs and analyze them outside of Databricks
- C Use the query performance and query profile view to inspect execution stages, joins, and aggregations
- D Re-run the query multiple times and compare execution durations
Answer and rationale
Answer: C
Rationale
- A is incorrect. Warehouse monitoring gives broad utilization, not detailed query-stage analysis.
- B is incorrect. External log analysis is unnecessary for this task.
- C is correct. Query performance and profile views show execution stages and bottlenecks.
- D is incorrect. Re-running the query may show timing variation but not detailed execution causes.
Question 18: CASE statement
You have a table called sales_data with columns order_id, customer_id, order_amount, and sales_rep. You need to create a new column called order_category that classifies orders as follows:
“Small” for orders ≤ $50,000
“Medium” for orders between $50,001 and $200,000
“Large” for orders > $200,000
- A
SELECT *,
CASE
WHEN order_amount <= 50000 THEN 'Small'
WHEN order_amount > 50000 AND order_amount <= 200000 THEN 'Medium'
ELSE 'Large'
END AS order_category
FROM sales_data;
- B
SELECT *,
IF(order_amount <= 50000, 'Small',
IF(order_amount <= 200000, 'Medium', 'Large')) AS order_category
FROM sales_data;
- C
SELECT *,
CASE order_amount
WHEN <= 50000 THEN 'Small'
WHEN <= 200000 THEN 'Medium'
ELSE 'Large'
END AS order_category
FROM sales_data;
- D
SELECT *,
CATEGORIZE(order_amount, 50000, 200000, 'Small', 'Medium', 'Large') AS order_category
FROM sales_data;
Answer and rationale
Answer: A
Rationale
- A is correct. It uses a searched CASE expression with proper range conditions.
- B is incorrect. Although nested IF logic may be possible in some SQL contexts, it is not the expected answer here.
- C is incorrect. This is invalid CASE syntax because comparison operators cannot be used this way in a simple CASE expression.
- D is incorrect. CATEGORIZE is not a standard SQL function for this task.
Question 19: Unity Catalog hierarchy top level
What object sits at the top level of the data access hierarchy in Unity Catalog?
- A Table
- B Schema
- C Workspace
- D Metastore
Answer and rationale
Answer: D
Rationale
- A is incorrect. Tables are lower-level data objects.
- B is incorrect. Schemas exist below catalogs.
- C is incorrect. A workspace is not the top-level UC data access object.
- D is correct. The metastore is at the top of the Unity Catalog data access hierarchy.
Question 20: Databricks Marketplace sharing
What powers the Databricks Marketplace's ability to share data?
- A REST APIs
- B Unity Catalog Metastore
- C Delta Sharing
- D AWS S3
Answer and rationale
Answer: C
Rationale
- A is incorrect. REST APIs may support services but are not the sharing mechanism named here.
- B is incorrect. Unity Catalog Metastore supports governance but is not the sharing technology itself.
- C is correct. Delta Sharing powers data sharing in Databricks Marketplace.
- D is incorrect. AWS S3 is cloud storage, not the Marketplace sharing protocol.
Top comments (0)