Skip to main content
Create new records using the CREATE operation.

Basic Syntax

:CREATE Entity WITH field:value, field:value

Create Single Record

:CREATE User WITH name:"John", email:"[email protected]", age:30
DatabaseOutput
PostgreSQLINSERT INTO users (name, email, age) VALUES ('John', '[email protected]', 30)
MySQLINSERT INTO users (name, email, age) VALUES ('John', '[email protected]', 30)
MongoDBdb.users.insertOne({ name: 'John', email: '[email protected]', age: 30 })
RedisHMSET users:1 name "John" email "[email protected]" age 30

Data Types

-- String
:CREATE User WITH name:"John"

-- Number
:CREATE User WITH age:30

-- Boolean
:CREATE User WITH active:true

-- Null
:CREATE User WITH deleted_at:null

Multiple Fields

:CREATE Product WITH 
  name:"Laptop",
  price:999.99,
  category:"Electronics",
  in_stock:true,
  quantity:50

With Timestamps

:CREATE User WITH 
  name:"John",
  email:"[email protected]",
  created_at:"2024-01-15T10:30:00Z"

Bulk Insert

Insert multiple records at once. Each record is wrapped in square brackets with = assignments.
:BULK INSERT User WITH 
  [name = Alice, age = 25] 
  [name = Bob, age = 30] 
  [name = Charlie, age = 35]
DatabaseOutput
PostgreSQLINSERT INTO users (name, age) VALUES ('Alice', 25), ('Bob', 30), ('Charlie', 35)
MySQLINSERT INTO users (name, age) VALUES ('Alice', 25), ('Bob', 30), ('Charlie', 35)
MongoDBdb.users.insertMany([{ name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }, { name: 'Charlie', age: 35 }])

Upsert

Insert or update if exists. Specify conflict field(s) with ON.
:UPSERT User WITH email:"[email protected]", name:"John Updated", login_count:1 ON email
DatabaseOutput
PostgreSQLINSERT INTO users (...) ON CONFLICT (email) DO UPDATE SET name = 'John Updated', login_count = 1
MySQLINSERT INTO users (...) ON DUPLICATE KEY UPDATE name = 'John Updated', login_count = 1
MongoDBdb.users.updateOne({ email: '[email protected]' }, { $set: { ... } }, { upsert: true })

Upsert with Composite Key

:UPSERT OrderItem WITH order_id:1, product_id:5, quantity:3 ON order_id, product_id

Replace

Delete and insert (MySQL-specific behavior).
:REPLACE User WITH id:1, name:"John Replaced", email:"[email protected]"
DatabaseOutput
PostgreSQLUses UPSERT behavior
MySQLREPLACE INTO users (id, name, email) VALUES (...)
MongoDBdb.users.replaceOne({ _id: 1 }, { ... })

Complete Examples

User Registration

:CREATE User WITH 
  email:"[email protected]",
  password_hash:"$2b$10$...",
  name:"Jane Doe",
  role:"user",
  active:true,
  created_at:"2024-01-15T10:30:00Z"

E-commerce Order

:CREATE Order WITH 
  user_id:42,
  total:149.99,
  status:"pending",
  shipping_address:"123 Main St",
  created_at:"2024-01-15T10:30:00Z"

Bulk Product Import

:BULK INSERT Product WITH 
  [sku = ABC123, name = Widget, price = 9.99, quantity = 100]
  [sku = DEF456, name = Gadget, price = 19.99, quantity = 50]
  [sku = GHI789, name = Gizmo, price = 29.99, quantity = 25]

Next Steps