DATABRICKS-DATA-ENGINEER-ASSOCIATE practice question 25 of 25

Which of the following commands will return the location of database customer360?

Full set: 177 questions
Answer options
A: DESCRIBE LOCATION customer360;
B: DROP DATABASE customer360;
C: DESCRIBE DATABASE customer360; Correct answer
D: ALTER DATABASE customer360 SET DBPROPERTIES ('location' = '/user'};
E: USE DATABASE customer360;
Correct Answer:
C. DESCRIBE DATABASE customer360;
Explanation

The DESCRIBE DATABASE command is used to retrieve metadata about a specified database. The output of this command includes essential information such as the database name, its comment (if any), and its location on the filesystem. The EXTENDED option can be used to retrieve additional properties. This command is the direct and standard way to query for the location of a database within Databricks SQL.

Why Incorrect

A. DESCRIBE LOCATION customer360; This is not a valid SQL command in Databricks. The DESCRIBE command requires a valid object type like DATABASE, TABLE, or FUNCTION.
B. DROP DATABASE customer360; This command is a Data Definition Language (DDL) statement used to permanently delete a database and its associated objects, not to retrieve information about it.
D. ALTER DATABASE customer360 SET DBPROPERTIES ('location' = '/user'};
This command modifies the properties of a database. It is used to set or change the location, not to query or return the current location.
E. USE DATABASE customer360; This command sets the current default database for the session. It does not return any metadata or information about the database itself. ---

References

1. Databricks SQL Language Reference

DESCRIBE DATABASE:

Source: Official Databricks Documentation

Content: "Returns the metadata of an existing database. The metadata information includes database name

database comment

and database location on the filesystem."

Reference: Databricks Documentation > SQL reference > Data definition language > DESCRIBE DATABASE.

2. Databricks SQL Language Reference

DROP DATABASE:

Source: Official Databricks Documentation

Content: "Drops (deletes) a database. If the database does not exist

an exception is thrown."

Reference: Databricks Documentation > SQL reference > Data definition language > DROP DATABASE.

3. Databricks SQL Language Reference

ALTER DATABASE:

Source: Official Databricks Documentation

Content: "This statement is used to alter the properties of a database. Currently

the only supported use case is to set the DBPROPERTIES of a database." (Note: SET LOCATION is also supported). This confirms it's a modification command.

Reference: Databricks Documentation > SQL reference > Data definition language > ALTER DATABASE.

4. Databricks SQL Language Reference

USE:

Source: Official Databricks Documentation

Content: "The USE statement sets the current catalog or database."

Reference: Databricks Documentation > SQL reference > Data manipulation language > USE.

Scroll to Top