implemented SQL-query builder