Get all fields with Salesforce SOQL

Use the FIELDS() function.

SELECT FIELDS(ALL) FROM Account

The FIELDS() function takes a single parameter with 3 options:

FIELDS(ALL) – returns all fields for both standard and custom objects.

FIELDS(CUSTOM) – returns custom fields on standard and custom Salesforce objects.

FIELDS(STANDARD) – returns all standard fields on a Salesforce object. This includes the 11 common fields (Id, Name, IsDeleted, CreatedDate, etc.) on custom objects. On standard Salesforce objects,

The FIELDS() function can be mixed in with the fields list in the SELECT clause.

SELECT Id, Name, FIELDS(CUSTOM) Account 

Examples:

Get All Fields from Standard Object

 SELECT FIELDS(ALL) FROM Account

Get All Fields from Custom Object

SELECT FIELDS(ALL) FROM Product__c

Get Standard Fields from Standard Object

SELECT FIELDS(STANDARD) FROM Account
SELECT FIELDS(STANDARD) FROM Contact

Get Standard Fields from Custom Object

SELECT FIELDS(STANDARD) FROM Product__c

Get All Custom Fields from Standard Object

SELECT Id, Name, FIELDS(CUSTOM) FROM Account
SELECT Id, Name, FIELDS(CUSTOM) FROM Contact

Get All Custom Fields from Custom Object

SELECT FIELDS(CUSTOM) FROM Product__c

Notes:

In Workbench a LIMIT of 200 or fewer is required for all queries using FIELDS(ALL) or custom object queries using FIELDS(CUSTOM).

Comments:

FIELDS(ALL) is the SOQL equivalent of SELECT * in SQL.