Dynamic SOQL refers to the creation of a SOQL string at runtime with Apex code. Dynamic SOQL enables you to create more flexible applications. For example, you can create a search based on input from an end user, or update records with varying field names.
Sample SOQL:
String myString = ‘TestName’;
List<Account> acctList = Database.query(‘SELECT Id FROM Account WHERE Name = :myString’);
Cheers!!!