Constructing queries from tokens

A database token is a value of either the data or the metadata. Usually, such tokens are combined with formal language constructs to form queries. In this paper we show how a given set of tokens may be completed to a proper query. This process provides a useful means of communication between naive users and databases, allowing them to express simple requests by listing several tokens. As the inferred query is always shown to the user, this process has a side effect of instructing the user in the proper use of the query language. The method is described and demonstrated with relational databases, but its principles may be implemented with other databases as well.