Insert


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
round-pushpin Statement to insert a single document into the Temporary schema
INSERT INTO Temporary(FirstName,  LastName)
Values ('Stellar', 'Object')

round-pushpin 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')

round-pushpin 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
round-pushpin 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