Apex Variables in SOQL Queries
Bind expressions are used in the
WHERE clause to compare the field’s value with an Apex variable. It uses the following syntax:
Consider this Apex snippet:
In this example, the name of the clinic is compared with a variable clinicName. You will find it extremely helpful if the code was in an apex method where values were passed as variables.
Example: Design an apex method that returns the maximum number of appointments it can handle in a day given the clinic’s name.