Chapter 2 of 7 · Databricks Associate Developer for Apache Spark
Using Spark SQL
Using Spark SQL for the Databricks Spark Developer exam: JDBC and file sources, SQL on files, save modes, persistent tables and temporary views.
- 3topics
- 12 minfast track
- 20%of the exam
Topics in this chapter
Take them in order, or jump to the one you need.
- 1Reading and Writing JDBC and File SourcesDatabricks Spark Developer: read JDBC databases and files into DataFrames, write them back, and use overwrite and partitionBy to…4 min
- 2Querying Files Directly and Save ModesDatabricks Spark Developer: run SQL on ORC, JSON, CSV, text and Delta files with format.`path`, and pick the right save mode when…4 min
- 3Persistent Tables and Temporary ViewsDatabricks Spark Developer: save DataFrames as persistent tables with partitioning, bucketing and sorting, and query temporary…4 min
About this chapter
What this chapter covers
Using Spark SQL is 20% of the Databricks Associate Developer for Apache Spark exam, tied with Apache Spark Architecture and Components as the second largest chapter. It covers moving data in and out of Spark and making DataFrames queryable with SQL.
The chapter has three parts: reading and writing JDBC and file sources, including overwrite and partitionBy, running SQL directly on files and choosing a save mode, and saving persistent tables with partitioning, bucketing and sorting or registering temporary views.
Questions are single-answer multiple choice. Many show a short PySpark snippet or SQL statement in the stem or the options and ask what it returns, what happens when the target already exists, which line fixes it, or which call meets a requirement. There are no exhibits.
How the topics fit together
You load data from a database or from files, query it with SQL either directly on the files or through a registered view, and write the result out. A persistent table keeps the data and its layout for later sessions.
- Source questions ask how to read a JDBC table in parallel or which format suits a requirement.
- File query questions ask for the syntax that runs SQL straight on a folder of files.
- Save mode questions ask what append, overwrite, ignore and the default do when data exists.
- Table questions ask which layout speeds retrieval and what happens on DROP TABLE.
- View questions ask which scope a temporary or global view has.
When a question mentions "already exists", think of the four save modes first. The default fails, append adds, overwrite replaces and ignore skips.
How to use these pages
Each topic page has the same shape, so you can skim for what you need.
- What it is: the idea in plain words.
- How it works: the mechanism, with tables and examples.
- What to remember for the exam: the facts to memorize and how questions are phrased.
- Common mistakes: the classic traps.
- Check yourself: three questions to test your understanding.
Ready for more practice?
The full Databricks Associate Developer for Apache Spark question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.