RazorSQL Salesforce SQL Support

RazorSQL provides the ability to connect to Salesforce.com databases. It provides visual tools for viewing and editing tables and more. RazorSQL also allows users to use SQL syntax to execute SQL selects, inserts, updates, and deletes against Salesforce.com databases.

Listed below is information on the SQL syntax supported by RazorSQL with Salesforce.

General Notes

The Salesforce.com database does not natively support many SQL statements. Some types of SQL statements executed in RazorSQL are translated into Salesforce specific API calls by RazorSQL. RazorSQL does not support the full SQL standard for Salesforce. Listed below are the select, insert, update, and delete SQL syntax supported by RazorSQL.

Select

RazorSQL sends select statements as is to the Salesforce.com web service for execution. Salesforce has its own query language known as Salesforce Object Query Lanaguage (SOQL). This is similar, and in many cases identical, to SQL select statements. For more information on the SOQL syntax, please see the following:

http://www.salesforce.com/us/developer/docs/soql_sosl/

Listed below are examples of Salesforce select queries:

select * from Account select Id, Name, Type from Account select * from Account where Name = 'Edge Communications' select * from Account where NumberofLocations__c > 1 and BillingPostalCode <> null

Select from Multiple Tables / Joining Tables

The syntax for selecting data from multiple tables in one query is different than the normal SQL join syntax. The example below shows how to write a select query to select data from both the Account and Contact tables. The LastName field is selected from Contact, and the other fields are selected from the Account table. The join happens behind the scenes.

SELECT Account.Name, Account.BillingStreet, Account.BillingCity, Account.BillingState, LastName FROM Contact

Insert

RazorSQL adds its own support for Salesforce SQL insert statements. RazorSQL requires the insert statement to be in a specific syntax to be accepted. Listed below are the required syntax and some examples.

insert into table_name (column_name_list) values (value_list) insert into Merchandise__c (Name, Description__c, Price__c, Total_Inventory__c) values ('Wagon', 'A toy wagin', 4.97, 100.0)

Update

RazorSQL adds its own support for Salesforce SQL update statements. RazorSQL requires the update statement to be in a specific syntax to be accepted. The Id column must be included in the where clause of the update statement. Listed below are the requied syntax and an example.

update table_name set column_name = column_value where Id = 'id_value' update Merchandise__c set Name = 'Small Wagon' where Id = 'a00i00000068M7PAAU'

Delete

RazorSQL adds its own support for Salesforce SQL delete statements. RazorSQL requires the delete statement to be in a specific syntax to be accepted. The Id column must be included in the where clause of the delete statement. Listed below are the required syntax and an example.

delete from table_name where Id = 'id_value' DELETE FROM Merchandise__c WHERE Id = 'a00i00000067AjkAAE';