Extracting SQL queries from code stage-5