Skip to content

Insert Query

The insert query is used to add new rows into your database, there are different possibilities to that.

Insert a single value

employees.insert()
        .set("Name", "McCain")
        .set("FirstName", "Jack")
        .set("ManagerId", 34)
        .set("Active", true)
        .execute("Id");
int id = employees.insert()
        .set("Name", "McCain")
        .set("FirstName", "Jack")
        .set("ManagerId", 34)
        .set("Active", true)
        .executeAndGetGeneratedKeyAsInt("Id");

Insert multiple values

employees.insert()
        .set("Name", "McCain", "Bill")
        .set("FirstName", "Jack", "Shepard")
        .set("ManagerId", 34, 48)
        .set("Active", true, true)
        .execute();

Last update: 2020-12-12