Apache Ignite SQL Documentation

The Apache Ignite SQL Developer Hub

Welcome to the Apache Ignite SQL developer hub. You'll find comprehensive guides and documentation to help you start working with Apache Ignite SQL as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Inserts data into a table.

INSERT INTO tableName 
  {[( columnName [,...])]
  {VALUES {({DEFAULT | expression} [,...])} [,...] | [DIRECT] [SORTED] select}} 
  | {SET {columnName = {DEFAULT | expression}} [,...]}

Parameters

  • tableName - name of the table to be updated.
  • columnName - name of a column to be initialized with a value from the VALUES clause.

Description

INSERT command adds an entry or entries into a table (aka. cache in Ignite).

Since Ignite stores all the data in a form of key-value pairs, all the INSERT statements are finally transformed into a set of key-value operations.

If a single key-value pair is being added into a cache then, eventually, an INSERT statement will be converted into a cache.putIfAbsent(...) operation. In other cases, when multiple key-value pairs are inserted, the DML engine creates an EntryProcessor for each pair and uses cache.invokeAll(...) to propagate the data into a cache.

Refer to concurrent modifications section that explains how SQL engine solves concurrency issues.

Examples

Insert a new Person into the table:

INSERT INTO Person (id, name, city_id) VALUES (1, 'John Doe', 3);

Fill in Person table with the data retrieved from Account table:

INSERT INTO Person(id, name, city_id)
   (SELECT a.id + 1000, concat(a.firstName, a.secondName), a.city_id 
   FROM Account a WHERE a.id > 100 AND a.id < 1000);

Note

Java, .NET, C++ users can execute INSERT queries using native APIs:

See Also

Updated less than a minute ago

INSERT


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.