
Answer-first summary for fast verification
Answer: By running `spark.sql("CREATE CATALOG ml")`.
✅ **D. By running `spark.sql("CREATE CATALOG ml")`.** To create a new catalog in Unity Catalog using Spark SQL, the `CREATE CATALOG` command is used followed by the desired catalog name (in this case, 'ml'). This command establishes a new top-level namespace for organizing data assets. ❌ **A. By running `spark.sql("CREATE SCHEMA ml")`.** The `CREATE SCHEMA` command creates a new schema within the currently active catalog, not a new catalog. Schemas are used to organize tables and other data objects under an existing catalog. ❌ **B. By running `spark.sql("USE CATALOG ml")`.** The `USE CATALOG` command switches the current active catalog to the specified one ('ml' here). It does not create a new catalog; the catalog must already exist. ❌ **C. By running `spark.sql("CREATE CATALOG IF NOT EXISTS ml")`.** While this command is valid and creates the catalog 'ml' if it doesn't exist, the `IF NOT EXISTS` clause is optional. The fundamental command for creating a catalog is `CREATE CATALOG <catalog_name>`.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
What is the correct Spark SQL command to create a new catalog named 'ml' in Unity Catalog?
A
By running spark.sql("CREATE SCHEMA ml").
B
By running spark.sql("USE CATALOG ml").
C
By running spark.sql("CREATE CATALOG IF NOT EXISTS ml").
D
By running spark.sql("CREATE CATALOG ml").
No comments yet.