Similar to the SELECT command in Structured Query Language (SQL), SOQL allows you to specify the source object (such as Account), a list of fields to retrieve, and conditions for selecting rows in the source object.
SOQL uses the SELECT statement combined with filtering statements to return sets of data which may optionally be ordered:
SELECT one or more fields FROM an object WHERE filter statements and, optionally, results are ordered
SELECT AccountId, Name FROM Account WHERE Name = 'Sandy'
For a complete description of the syntax, see SOQL SELECT Syntax.