Creating a dynamic SOQL which includes all the fields
I have seen this question several times on developer forums and I thought it could be another addition to Salesforce cookies. If you are wondering how can you query all the fields of an object then you can use the following code snippet.
https://gist.github.com/sfcure/81888ea3d0038b8f14df7c2006d98d7a
The above code snippet using describe calls to get all the fields and then created a dynamic SOQL query to get all the field values.
This is quite similar to SQL query which uses wildcard characters – SELECT * FROM Table.