Patent ID: 7814090

Claim:
A query generator, implemented in a computer system comprising a processor operable to execute computer program instructions, a memory operable to store computer program instructions executable by the processor and data to be processed by the processor, and computer program instructions stored in the memory and executable to implement the query generator, for generating a query for retrieving data from a database comprising at least one table, the query referring to one or more data items in a first view defined to expose a portion of the database and to one or more data items that are not exposed by the first view, at least one of which has an associated flag set that defines the at least one item having the flag set as an item that is to be included in a second view to avoid the creation of a redundant join, wherein the query generator is configured to: a) receive user input indicating selected items to be retrieved from the database; b) ascertain whether any of the selected items that are not exposed by the first view are defined as items that are to be included in a second view to avoid the creation of a redundant join; and, c) when any of the selected items that are not exposed by the first view are defined as items that are to be included in a second view to avoid the creation of a redundant join: i) create the second view that is a copy of the first view and add a copy of each item that is to be included in a second view to avoid the creation of a redundant join to the second view to avoid the creation of a redundant join; and ii) create a query that refers only to the second view and the items exposed by the second view.