Currently I have a web application where a user can use dropdown lists to generate SQL SELECT statements like so:
Column Select Dropdown | Operator Dropdown (= != >
There is a jquery plugin to do this, called QueryBuilder, which do this in an interesting way : http://mistic100.github.io/jQuery-QueryBuilder/