first step writing query