---
sidebar_position: 8
---

# CreateTable

Creates a new table with defined structure.

## Methods

### selectDatabase()
&rarr; (`database` = __String__) &rarr; `this`

Selects a different database for this query.

**Parameters**

| Parameter | Type | Description |
| -- | -- | -- |
| `database` | __String__ | Name of the database to select |

**Returns**

&rarr; `this`

***

### name()
&rarr; (`name` = __String__) &rarr; `this`

Sets the name of the new table.

**Parameters**

| Parameter | Type | Description |
| -- | -- | -- |
| `name` | __String__ | Name for the table |

**Returns**

&rarr; `this`

***

### structure()
&rarr; (`structure` = [Structure](./structure)) &rarr; `this`

The desired structure for the table to get.

**Parameters**

| Parameter | Type | Description |
| -- | -- | -- |
| `structure` | [Structure](./structure) | Structure for the table. |

**Returns**

&rarr; `this`

***

### execute()
`async` &rarr; () &rarr; __any__

:::warning Possible crash
[structure()](#structure) must always be given.
:::

Executes the prepared query.

**Returns**

&rarr; __any__ - The result of 'CREATE TABLE [...]'-query

***