Database query test finalised