---
title: "This endpoint creates a new table with the predictions result-set."
method: POST
path: "/api/databases/{databaseName}/tables"
---

# This endpoint creates a new table with the predictions result-set.

`POST /api/databases/{databaseName}/tables`

Creates a new table from a select query. See [CREATE table documentation](https://docs.mindsdb.com/sql/create/table).

## Path parameters

- `databaseName` string, required

## Request body

- object
  - `table` object
    - `name` string
    - `select` string — SELECT statement to create the table from
    - `replace` boolean — Whether or not to delete a pre-existing table before creating it

## Response `200`

Table created

- Table
  - `name` string
  - `type` string — Type of table (data | view)

## Other responses

- `401` — Invalid API key error message
- `404` — Database not found
- `500` — Server error

---

[API](https://skmtc.net/mindsdb/apis/mindsdb-api.md) · [All operations](https://skmtc.net/mindsdb/apis/mindsdb-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mindsdb/mindsdb-api/versions/387ff52538f9/schema)
