
Answer-first summary for fast verification
Answer: `CREATE DATABASE IF NOT EXISTS customer360 LOCATION '/customer/customer360';`
## Explanation The correct answer is **C** because: - The `IF NOT EXISTS` clause ensures that the database is only created if it doesn't already exist, which addresses the engineer's uncertainty about whether a colleague has already created it - The `LOCATION '/customer/customer360'` clause specifies the exact location where the database should be created - Option A would fail if the database already exists - Option B doesn't specify the location, so it would use the default location - Options D and E are incorrect because `DELTA` is not a valid keyword in the `CREATE DATABASE` syntax - Delta is a table format, not a database type This command follows the proper Spark SQL syntax for creating a database with conditional existence checking and custom location specification.
Author: LeetQuiz .
Ultimate access to all questions.
No comments yet.
Question 12
A data engineer needs to create a database called customer360 at the location /customer/customer360. The data engineer is unsure if one of their colleagues has already created the database.
Which of the following commands should the data engineer run to complete this task?
A
CREATE DATABASE customer360 LOCATION '/customer/customer360';
B
CREATE DATABASE IF NOT EXISTS customer360;
C
CREATE DATABASE IF NOT EXISTS customer360 LOCATION '/customer/customer360';
D
CREATE DATABASE IF NOT EXISTS customer360 DELTA LOCATION '/customer/customer360';
E
CREATE DATABASE customer360 DELTA LOCATION '/customer/customer360';