1. A query generator operable to generate a query for at least one of retrieving data that satisfy a conditional expression from a database and performing an arbitrary calculation on at least part of the retrieved data, the query generator being adapted to: a) receive an input query; b) analyze the input query to ascertain whether the input query contains a replaceable token; and c) if the input query contains a replaceable token, replace the replaceable token with at least one of user input specifying a parameter of the conditional expression and the arbitrary calculation, thereby performing at least one of generating an output query for retrieving the data that satisfy the conditional expression and performing the arbitrary calculation on the retrieved data.