# insert

inline fun <T : Table> T.insert(crossinline body: T.(InsertStatement<Number>) -> Unit): InsertStatement<Number>

Represents the SQL statement that inserts a new row into a table.

#### Samples

org.jetbrains.exposed.sql.tests.h2.H2Tests.insertInH2

fun <T : Table> T.insert(selectQuery: AbstractQuery<*>, columns: List<Column<*>> = this.columns.filter { it.isValidIfAutoIncrement() }): Int?

Represents the SQL statement that uses data retrieved from a selectQuery to insert new rows into a table.

#### Return

The number of inserted rows, or `null` if nothing was retrieved after statement execution.

#### Parameters

selectQuery

Source `SELECT` query that provides the values to insert.

columns

Columns to insert the values into. This defaults to all columns in the table that are not auto-increment columns without a valid sequence to generate new values.

#### Samples

org.jetbrains.exposed.sql.tests.shared.dml.InsertSelectTests.testInsertSelect04