Building relational query handler