# MotherDuck

## Copy your MotherDuck service token

Follow the steps in [this section ](https://motherduck.com/docs/authenticating-to-motherduck#fetching-the-service-token)of the MotherDuck documentation.

## Set up a MotherDuck connection

When inside a workbook, click **View** > **Databases**, then click the **+** icon and follow the on-screen instructions.

<figure><img src="https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FQDHq4waNgo5sB8F1zNdC%2FScreenshot%202023-09-11%20at%2016.01.53.png?alt=media&#x26;token=1f77b6ff-61fd-4391-aaab-78f9dca18f96" alt=""><figcaption></figcaption></figure>

The "Database Name" configuration is optional. If you configure it, the connection will by default connect to that database, but other databases are still accessible.

## Query the database

You can now query your MotherDuck database with a [sql-cell](https://datalab-docs.datacamp.com/work/sql-cell "mention"). Select it in the **Select source** dropdown in the top left corner of a SQL cell.

<figure><img src="https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FRSNNcgK7GNspu6tp2r6j%2FScreenshot%202023-09-11%20at%2016.17.39.png?alt=media&#x26;token=53cd67c8-4119-4a81-80a3-d9f89383a663" alt=""><figcaption></figcaption></figure>
