# TEMPORARY TABLES


> Create local temporary tables for session-scoped data.

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 `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmotherduck-sql-reference%2Ftemporary-tables%2F&page_title=TEMPORARY%20TABLES&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

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