Skip to main content

# Insert

Performs a query to insert new data into a table.

## Methods​

### selectDatabase()​

→ (`database` = String) → `this`

Selects a different database for this query.

Parameters

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

Returns

→ `this`

### data()​

→ (`objects` = Array<Object>) → `this`

The data (rows) to insert.

Parameters

Parameter | Type | Description
--- | --- | ---
`objects` | Array<Object> | Array containing objects to insert, where the key represent the column-name. All objects must have the same key-structure!

Returns

→ `this`

### execute()​

`async` → () → any

Executes the prepared query.

Returns

→ any - Query result