USE database (Databricks SQL)

Sets the current database (schema). After the current database is set, the unqualified artifacts such as tables, functions, and views that are referenced by SQLs are resolved from the current database. The default database name is default.


USE database_name


  • database_name

    Name of the database to use. If the database does not exist, an exception is thrown.


-- Use the 'userdb' which exists.
> USE userdb;

-- Use the 'userdb1' which doesn't exist
> USE userdb1;
  Error: Database 'userdb1' not found;