---
title: databaseExists
description: "Catalog.databaseExists method in PySpark: Check if the database with the specified name exists."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/catalog/databaseExists
---

# databaseExists

Check if the database with the specified name exists.

## Syntax

```
databaseExists(dbName: str)
```

## Parameters

| Parameter | Type | Description                                                                  |
| --------- | ---- | ---------------------------------------------------------------------------- |
| `dbName`  | str  | Name of the database to check existence. Can be qualified with catalog name. |

## Returns

`bool`

Indicating whether the database exists.

## Examples

```python
# Check if 'test_new_database' database exists
spark.catalog.databaseExists("test_new_database")
# False
_ = spark.sql("CREATE DATABASE test_new_database")
spark.catalog.databaseExists("test_new_database")
# True

# Using the fully qualified name with the catalog name.
spark.catalog.databaseExists("spark_catalog.test_new_database")
# True
_ = spark.sql("DROP DATABASE test_new_database")
```
