Insert
Table of Contents
Overview
Insert is used to create new documents in a database schema. Note that the set of fields in a schema is not fixed on a per-row basis.
Standard Syntax
Statement to insert a single document into the Temporary schema
INSERT INTO Temporary(FirstName, LastName)
Values ('Stellar', 'Object')
Statement to insert multiple documents into the Temporary schema. You can repeat as many of these sets as you like.
INSERT INTO Temporary (FirstName, LastName)
Values ('Stellar', 'Object'), ('Solar', 'Mass'), ('Single', 'Sol')
Statement to insert the results from a select statement into the Test:Translation schema.
INSERT INTO Test:Translation (SourceWordId,SourceWord,SourceLanguage,TargetWordId,TargetWord,TargetLanguage)
SELECT
sw.Id as SourceWordId,
sw.Text as SourceWord,
sl.Name as SourceLanguage,
tw.Id as TargetWordId,
tw.Text as TargetWord,
tl.Name as TargetLanguage
FROM
WordList:Word as sw
INNER JOIN WordList:Language as sl
ON sl.Id = sw.LanguageId
INNER JOIN WordList:Synonym as S
ON S.SourceWordId = sw.Id
INNER JOIN WordList:Word as tw
ON tw.Id = S.TargetWordId
INNER JOIN WordList:Language as tl
ON tl.Id = TW.LanguageId
WHERE
sw.Text = 'gym'
Alternate syntax
Ragged key-value-pair inserts are also supported allowing for inserting multiple rows and specifying the field names for each row.
insert into Test
(FirstName: 'Jane', LastName: 'Doe'),
(FirstName: 'John', MiddleName: Guid(), LastName: 'Doe')
Related
- Keywords - A breakdown of all high-level statements available via the query handler.