SOQL vs SQL

SOQL – Salesforce Object Query Language – is very similar to SQL.

Comparing Force.com SOQL & SQL

A big difference between SOQL and SQL – is the simplified syntax in SOQL to traverse object relationships.

The basic structure of SOQL is very similar to SQL as you see below:
SELECT Id, Name, Phone
FROM Contact
WHERE Phone <> null
AND Name LIKE ‘%adam%’
ORDER BY Name
LIMIT 50

However the ease with which you can access related records in one query without needing to do complex joins is amazing!
SELECT Id, Name, Phone, Account.Name
FROM Contact
WHERE Phone <> null
AND Name LIKE ‘%adam%’
ORDER BY Name
LIMIT 50
Contact is a child of Account. Account and Contact have a master-detail relationship. In the above query you are able to reference the master record from a query on detail records very easily.

Keep in mind that you will access custom objects and fields through their API name (i.e internal name) which has the suffix __c. The suffix __r is used when referencing the related objects or fields.

Other differences between .NET SQL and Force.com SOQL

In .NET you store connection strings in web.config file. In Force.com, there are no connection strings – database access is inherent in access to the platform.

In .NET you manage your authentication scheme – either through Active Directory or through other methods. In Force.com authentication is built through the integrated cloud directory.

In .NET you map database schema to objects manually or using entity framework. In Force.com there is tight relationship between database and objects: Database fields automatically map to their corresponding language types. If you add a field to a database object, that field can be immediately referenced from workflows and code – no tools or xml files required.

In .NET you manage your database deployment either on-premise, in hosted data centers or in the Azure cloud. In Force.com, there are no deployment tasks: security, access, upgrading and data maintenance and integrity issues are all handled by Salesforce.