---
sidebar_position: 1
title: TEMPORARY TABLES
description: Create local temporary tables for session-scoped data.
---

# TEMPORARY TABLES

The `CREATE TEMPORARY TABLE` statement creates a new a temporary from a sql query. This command is used to create a local temporary table. [More information can be found in the DuckDB documentation.](https://duckdb.org/docs/sql/statements/create_table.html#temporary-tables)

## Syntax

```sql
CREATE [ OR REPLACE ] TEMPORARY TABLE [ IF NOT EXISTS ] <table name> AS ...
```

Temporary Tables can be created traditionally with column names and types, or with `Create Table ... As Select` (CTAS).


### Shorthand Convention

The word `TEMP` can be used interchangably with `TEMPORARY`.


## Example Usage

```sql
CREATE TEMPORARY TABLE flights AS
    FROM 'https://duckdb.org/data/flights.csv';
```

This will create a local table with data from the duckdb `flights.csv` file.

## Notes

- Temporary Tables in MotherDuck persist locally, not on the server. As such, local constraints should be considered when using them.
- Because they are bound to your session, when your session ends, any temporary tables will no longer be available.



---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

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

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed payloads, and `429` when rate-limited.
