Using UPDATE keyword in SOQL helps us to lock the records from being updating from another request.
Account  objAccts = [SELECT Id, Name FROM Account where Country='India' FOR UPDATE];
Note: We can’t use the
ORDER BY keywords in any SOQL query that uses locking.
String str = 'biswajeet';
String revStr = str.reverse();
system.debug('Reversed string value is ' + revStr);
Sometimes in apex we required RecordType Id of an object by its Name. So, here is an example how we can find RecordType Id by Name.
In below example
BankAccount__c is the custom object and “Savings Account” is one of the RecordType Name of
BankAccount__c object. Now without SOQL I’ve to find “Savings Account” RecordType Id.
String recordTypeName = 'Savings Account';
String name = [SELECT Name FROM Account].Name;