Explanation: Correct syntax to use where clause is WHERE city = :city AND state = :state
This question validates knowledge on using dynamic queries in DB select operation.
Configure Dynamic Queries in the Select Operation
When you need to parameterize not only the WHERE clause but also parts of the query itself (for example, queries that compare tables that depend on a condition, or complex queries for which the project table columns need to vary), you can configure dynamic queries.
In the following example, you configure a dynamic query by using a full expression with a string in which the table depends on a variable $(vars.table). Although some of the query text is dynamic ("SELECT * FROM $(vars.table)), the WHERE clause still defines the WHERE condition using input parameters: in this case, WHERE name = :name.
In your Studio flow, select the Select operation.
In the operation configuration screen, set the SQL Query Text field to SELECT * FROM $(vars.table) WHERE name = :name.
Set the Input Parameters field to {'name' : payload}.
The following screenshot shows the configuration in Studio:
Graphical user interface, application
Description automatically generated
Figure 3. Dynamic query configuration
In the XML editor, the configuration looks like this:
- #["SELECT * FROM $(vars.table) WHERE name = :name"]
- #[{'name' : payload}]
You can apply input parameters only to parameters in a WHERE clause. To modify any other part of the query, use the DataWeave interpolation operator.
Mule Ref Doc: Query a Database Examples - Mule 4 | MuleSoft Documentation