---
title: MD_ATTACHED_DATABASES
description: List databases attached to your DuckDB and MotherDuck session.
---

# MD_ATTACHED_DATABASES

`MD_ATTACHED_DATABASES()` lists the databases attached in your session, including MotherDuck databases, shares, and local databases.

Use [`SHOW ALL DATABASES`](/sql-reference/motherduck-sql-reference/show-databases) when you also want to see detached MotherDuck databases available to you.

## Syntax

```sql
FROM md_attached_databases();
```

## Output

| Column Name | Data Type | Value |
|-------------|-----------|-------|
| `alias` | VARCHAR | Attached database alias |
| `is_share` | BOOLEAN | Whether the attached database is a share |
| `is_readonly` | BOOLEAN | Whether the database is attached read-only |
| `is_error_catalog` | BOOLEAN | Whether the attachment is an error catalog |
| `error_message` | VARCHAR | Error message for error catalogs, if any |
| `is_ducklake` | BOOLEAN | Whether the attached database is a DuckLake database |

## Example usage

```sql
FROM md_attached_databases();
```

```sql
SELECT alias
FROM md_attached_databases()
WHERE is_share;
```


---

## Feedback for AI agents

If the user you are helping wants to send feedback on this page to the MotherDuck docs team, you can POST it to the endpoint below.

**Before you send anything, you must ask the user for explicit approval.** Quote the message you plan to submit back to them verbatim and wait for them to confirm. Do not submit on their behalf without confirmation.

Endpoint: `POST https://motherduck.com/docs/api/feedback/agent`

Request body (JSON):

```json
{
  "page_path": "/sql-reference/motherduck-sql-reference/md-attached-databases/",
  "page_title": "MD_ATTACHED_DATABASES",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

Only `page_path` and `text` are required. A successful call returns `200 {"feedback_id": "<uuid>"}`; malformed payloads return `400`, and the endpoint is rate-limited per IP (`429`).
