Re: Automatic SQL query builder

From: Jan Hidders <hidders_at_REMOVE.THIS.win.tue.nl>
Date: 10 Oct 2001 15:37:00 GMT
Message-ID: <9q1pus$4t4$1_at_news.tue.nl>


Jaroslaw Tomczak wrote:
> Hi,
>
> As a part o bigger project I develop a kind of automatic query builder.
> This application receives as input:
> 1. A list of search criteria -- field names, their locations within
> appropriate tables and desired values
> 2. A list of fields that should be returned by query
> 3. Fields used for sorting results
> 4. Description of tables' relationships.
> As the results the application returns a correctly formulated SQL query.
>
> In trivial cases it is quite easy to analyse the above input and build
> appropriate queries, but many problems arises when one tries to
> implement joins and subqueries.
>
> I'm simply looking for some papers, reports, links that would relate to
> the problem described above.

If I understand your description of the input correctly you don't need any subqueries (and explicit joins are not necessary in SQL). In that case the traslation is trival: put all the mentioned tables in the from-clause, the select and the join-conditions in the where clause, the selected fields in the select-clause and the order conditions in the order-by-clause.

So what is exactly the problem?

-- 
  Jan Hidders
Received on Wed Oct 10 2001 - 17:37:00 CEST

Original text of this message