JDBC SQL DML Syntax

Here are the SQL DML commands we currently support:

UPDATE

A normal SQL UPDATE statement, including support for expressions that refer to other columns:

1
2
3
4
UPDATE Lead 
   SET firstName = firstname + ' ' + lastname, 
       NumberOfEmployees=NumberOfEmployees*2*annualRevenue
 WHERE annualRevenue > 0

INSERT

1
2
3
A normal SQL INSERT statement:
INSERT INTO Account(name, billingCity)
VALUES ('Mr Jones', 'Super City')

DELETE

A normal SQL DELETE statement:

1
2
DELETE FROM account
WHERE billingCity = 'Super City'

SELECT

SELECT behaves as per Salesforce SOQL, with the following enhancements:

1
2
SELECT FirstName as fn, LastName as ln, CreatedBy.name as cn
FROM Lead

SELECT non-features

We haven't rewritten the Salesforce SQL engine, and still inherit the other Salesforce-supplied SOQL SELECT limitations, including no support for normal SQL joins.

We also don't support SOQL's nested SELECT functionality, because it doesn't really fit into the relational model. eg:

1
2
3
SELECT Account.Name, Type,
(SELECT b.LastName FROM Account.Contacts b)
FROM Account

Data Type Literals

When using string literals in commands please adhere to the following formats:

DataType Format Example
DateTime yyyy-MM-dd'T'HH:mm:ss.SSS'Z' 2010-10-21T23:15:00.000Z
Date yyyy-MM-dd 2012-12-31
MultiPickList semi-colon-delimited values Red;Blue;Green

General Limitations

UPDATE, DELETE and SELECT all depend on the SOQL WHERE clause, so they inherit the limitations provided by Salesforce. In particular you cannot write a WHERE clause that compares one column to another, eg:

1
2
SELECT * FROM Lead
WHERE LastActivityDate = ConvertedDate